Loading Data from a .txt file to Table Stored as ORC in Hive

后端 未结 5 915
隐瞒了意图╮
隐瞒了意图╮ 2020-12-01 01:30

I have a data file which is in .txt format. I am using the file to load data into Hive tables. When I load the file in a table like

CREATE TABL         


        
5条回答
  •  孤街浪徒
    2020-12-01 01:55

    Steps:

    1. First create a table using stored as TEXTFILE  (i.e default or in whichever format you want to create table)
    2. Load data into text table.
    3. Create table using stored as ORC as select * from text_table;
    4. Select * from orc table.

    Example:

    CREATE TABLE text_table(line STRING);
    
    LOAD DATA 'path_of_file' OVERWRITE INTO text_table;
    
    CREATE TABLE orc_table STORED AS ORC AS SELECT * FROM text_table;
    
    SELECT * FROM orc_table;   /*(it can now be read)*/
    

提交回复
热议问题