导入到 Hive 的压缩数据中的意外元素

沃伊特

我正在尝试将压缩的 TXT 文件加载到 Hive 中。操作结束没有任何错误,但是在构造的表中,开头有一些意想不到的字符。为什么会这样?有关 Hive 中压缩数据存储的更多信息:https : //cwiki.apache.org/confluence/display/Hive/CompressedStorage

# cat test.txt
        tab1    tab2    tab3
        tab4    tab5    tab6
        tab7    tab8    tab9

# tar -cvzf test.gz test.txt
test.txt

# cat hiveQuery.hql
CREATE TABLE raw (col1 STRING,col2 STRING,col3 STRING)
   ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n'
;
LOAD DATA LOCAL INPATH '/test.gz' INTO TABLE raw;

#  hive -f hiveQuery.hql
WARNING: Use "yarn jar" to launch YARN applications.

Logging initialized using configuration in file:/etc/hive/2.4.0.0-169/0/hive-log4j.properties
OK
Time taken: 6.936 seconds
Loading data to table default.raw
Table default.raw stats: [numFiles=1, totalSize=145]
OK

# hive -e "select * from raw"
WARNING: Use "yarn jar" to launch YARN applications.

Logging initialized using configuration in file:/etc/hive/2.4.0.0-169/0/hive-log4j.properties
OK
test.txt                                                                  0000644 0000000 0000000 00000000055 13120243734 011273  0                 ustar   root                            root                              tab1    tab2    tab3
tab4    tab5    tab6
tab7    tab8    tab9
                                                                          NULL    NULL
大卫·杜杜·马尔科维茨

tar格式包含额外的头信息。
使用压缩文件gzip并查看它是否正常工作。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章