trafodion导入ORC文件压缩方式是snappy

1. 在hive里面创建一个外表:

create external table `orc_03`(
`id` int,
`bid` string,
`code` string,
`name` string,
`info` string,
`qrcode` string,
`ts` string,
`month` int)
stored as orc tblproperties ("orc.compress"="snappy")
;

2. 把orc文件put到hdfs文件系统里面:

hadoop fs -put /home/trafodion/testData/bizs.orc/part-00000-be341e01-a6a1-4180-b7e8-7cbe76ba4ded.snappy.orc /user/hive/warehouse/orc_03

3. 在hive中查看表记录:

select * from orc_03;

4. 在trafodion数据库里面创建结构和hive表一样的,但是字段都要设置成 utf8编码:

create table orc_03
	(
	id varchar(40 BYTES) CHARACTER SET UTF8,
	bid varchar(40 BYTES)  CHARACTER SET UTF8,
	code varchar(40 BYTES)  CHARACTER SET UTF8,
	name varchar(60 BYTES) CHARACTER SET UTF8,
	info varchar(50000 BYTES)  CHARACTER SET UTF8,
	qrcode varchar(80 BYTES)  CHARACTER SET UTF8,
	ts varchar(70 BYTES)  CHARACTER SET UTF8,
	month_time varchar(40 BYTES) CHARACTER SET UTF8
);

5. load  hive表到trafodion表

Load into orc_03 select * from hive.hive.orc_03;

6. 在创建表的时候可以用下面命令查看文件内容,从而判断是否有分区,和表字段信息。(备注:这个是hdfs里面的文件)

hive --orcfiledump /user/hive/warehouse/orc_01/month=1/part-00000-be341e01-a6a1-4180-b7e8-7cbe76ba4ded.snappy.orc | more




你可能感兴趣的:(trafodion)