tencent cloud

Feedback

Spark SQL

Last updated: 2024-11-01 16:26:14
    Note:
    You need to start the Hive and Spark component services in the EMR cluster.
    1. The current user has permissions in the EMR cluster.
    2. The corresponding database has been created in Hive, such as in the example: wedata_demo_db.

    Sample Code

    -- Create a User Information Table
    create table if not exists wedata_demo_db.user_info (
    user_id string COMMENT 'User ID',
    user_name string COMMENT 'Username',
    user_age int COMMENT 'Age',
    city string COMMENT 'City'
    ) COMMENT 'User Information Table';
    
    -- Insert data into the User Information Table
    insert into wedata_demo_db.user_info values ('001', 'Zhang San', 28, 'Beijing');
    insert into wedata_demo_db.user_info values ('002', 'Li Si', 35, 'Shanghai');
    insert into wedata_demo_db.user_info values ('003', 'Wang Wu', 22, 'Shenzhen');
    insert into wedata_demo_db.user_info values ('004', 'Zhao Liu', 45, 'Guangzhou');
    insert into wedata_demo_db.user_info values ('005', 'Xiao Ming', 20, 'Beijing');
    insert into wedata_demo_db.user_info values ('006', 'Xiao Hong', 30, 'Shanghai');
    insert into wedata_demo_db.user_info values ('007', 'Xiao Gang', 25, 'Shenzhen');
    insert into wedata_demo_db.user_info values ('008', 'Xiao Li', 40, 'Guangzhou');
    insert into wedata_demo_db.user_info values ('009', 'Xiao Zhang', 23, 'Beijing');
    insert into wedata_demo_db.user_info values ('010', 'Xiao Wang', 50, 'Shanghai');
    
    select * from wedata_demo_db.user_info;
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support