创建普通临时表:
create table if not exists test_orc_tmp(
name string,
gender string,
cnt BIGINT
)row format delimited fields terminated by '|' stored as textfile;
创建ORC表:
drop table test_orc;
create table if not exists test_orc(
name string,
gender string,
cnt BIGINT
)STORED AS ORC;
创建测试数据 vi orc.txt
goldenkey0|male|111
goldenkey1|male|112
goldenkey2|male|113
goldenkey3|male|114
goldenkey4|male|115
goldenkey5|male|116
goldenkey6|male|117
将测试数据导入临时普通表:
LOAD DATA INPATH '/tmp/orc.txt' OVERWRITE INTO TABLE test_orc_tmp;
将临时普通表的数据插入到ORC表:
INSERT INTO TABLE test_orc SELECT * FROM test_orc_tmp;
查看ORC表是否有数据:
select * from test_orc_tmp;