标签:mit 创建 for ext limit table null path 指定
1 2 x
2 2 x
3 2 x
4 2 x
创建TEXTFILE格式的表
CREATE TABLE test_txt(id int,num int,txt string) ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘\t‘ LINES TERMINATED BY ‘\n‘ STORED AS TEXTFILE;
指定分隔符为\t
ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘\t‘
指定换行符,不然可能会导入NULL数据
LINES TERMINATED BY ‘\n‘
创建ORC格式的表
CREATE TABLE test_orc(id int,num int,txt string) STORED AS ORC;
hdfs dfs -put /opt/test.txt /test
加载.txt文件到TEXTFILE格式的表
load data inpath ‘/test/test.txt‘ into table test_txt;
加载test_txt表数据到orc格式的表
INSERT INTO TABLE test_orc SELECT * FROM test_txt;
标签:mit 创建 for ext limit table null path 指定
原文地址:https://www.cnblogs.com/mergy/p/14286940.html