我正在尝试将压缩的txt文件加载到配置单元中。操作结束时没有任何错误,但是在构造的表中,开头有一些意外的字符。为什么会这样?有关配置单元中压缩数据存储的详细信息: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
1条答案
按热度按时间eufgjt7s1#
tar
格式包含其他标题信息。使用压缩文件
gzip
并确保它工作正常。