将数据从文本表上传到hive表时格式错误?

时间:2016-11-04 18:21:01

标签: hadoop hive bigdata

我能够上传数据,但问题是空值,问题在哪里,是否存在格式问题?

使用*

在本地表格中创建表格
     CREATE TABLE IF NOT EXISTS employee21( eid string, name String,
      salary String, destination String)
       COMMENT 'Employee details'
       ROW FORMAT DELIMITED
       FIELDS TERMINATED BY '\073'
       LINES TERMINATED BY '\n'
       STORED AS TEXTFILE;

将表格加载到配置单元

LOAD DATA LOCAL INPATH '/home/sma/mit123/s12.txt' INTO TABLE employee21;

     hive> LOAD DATA LOCAL INPATH '/home/mh/m123/s12.txt' INTO TABLE employee21;
     Copying data from file:/home/mh/mh123/s12.txt
     Copying file: file:/home/mh/mh123/s12.txt
     Loading data to table default.employee21
      Table default.employee21 stats: [num_partitions: 0, num_files: 1, num_rows:     0, total_size: 156, raw_data_size: 0]
    OK
    Time taken: 0.702 seconds
        hive> show tables;
         OK
       employee1
       employee11
       employee21
  Time taken: 0.159 seconds, Fetched: 3 row(s)

 **checking the table data in hive**

         hive> select * from employee21;
        OK
        1231  mh          45000    Proof reader NULL    NULL    NULL
        1203  Masthanvali 40000    Technical writer NULL    NULL    NULL
        1204  Kiran       40000    Hr Admin NULL    NULL    NULL
        1205  Kranthi     30000    Op Admin NULL    NULL    NULL
       Time taken: 0.104 seconds, Fetched: 4 row(s)

0 个答案:

没有答案