Insert data into hive table

前端 未结 6 1162
梦毁少年i
梦毁少年i 2021-02-04 06:22

Using a Cygwin distribution, I\'ve installed Hadoop 0.20.3 and Hive 0.11.0.

First of all, I don\'t understand how to use the Hive CLI:

hive> show tabl         


        
6条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-04 07:04

    If you already have a table pre_loaded_tbl with some data. You can use a trick to load the data into your table with following query

    INSERT INTO TABLE tweet_table 
      SELECT  "my_data" AS my_column 
        FROM   pre_loaded_tbl 
       LIMIT   5;
    

    Also please note that "my_data" is independent of any data in the pre_loaded_tbl. You can select any data and write any column name (here my_data and my_column). Hive does not require it to have same column name. However structure of select statement should be same as that of your tweet_table. You can use limit to determine how many times you can insert into the tweet_table.

    However if you haven't' created any table, you will have to load the data using file copy or load data commands in above answers.

提交回复
热议问题