Adding a comma separated table to Hive

前端 未结 4 1961
傲寒
傲寒 2021-01-26 08:38

I have a very basic question which is: How can I add a very simple table to Hive. My table is saved in a text file (.txt) which is saved in HDFS. I have tried to create an exter

4条回答
  •  攒了一身酷
    2021-01-26 09:17

    create external table Data (
            dummy INT,
            account_number INT, 
            balance INT, 
            firstname STRING, 
            lastname STRING, 
            age INT, 
            gender CHAR(1), 
            address STRING, 
            employer STRING, 
            email STRING,
            city STRING, 
            state CHAR(2)
        )
        row format delimited    
        FIELDS TERMINATED BY ','
        stored as textfile
        LOCATION '/Data';
    

    Then load file into table

    LOAD DATA INPATH '/KibTEst/Data.txt' INTO TABLE Data;
    

    Then

    select * from Data;
    

提交回复
热议问题