iceberg整合hive(从hive读取iceberg表数据)实践02⽬录
实现⽬标:
在hive查询iceberg表数据
1,创建hadoop catalog
在zeppelin 创建hadoop catalog
CREATE CATALOG hadoop_catalog WITH (
'type'='iceberg',
'catalog-type'='hadoop',
'warehou'='hdfs://bi-524:8020/tmp/warehou',
'property-version'='1'
);
注意点: 'warehou'='hdfs://bi-524:8020/tmp/warehou',
如图:
雷锋叔叔手抄报
2,创建基于hadoop_catalog的iceberg表
CREATE TABLE st.iceberg_hive (涧字怎么读
id BIGINT,
name STRING
高级讽刺人的话);
注意:
st.iceberg_hive
“hadoop_catalog”是上⾯创建的hadoop catalog名字 ,“test”是hive对应的test库,iceberg_hive是表名字
iceberg_hive不需要我们创建
如果这⾥报错,需要⼿动创建test库,我这⾥本⾝就存在⼀个test库,所以不演⽰了。
3,从hadoop_catalog来创建hive表,在hive shell执⾏
千句文1,添加jar :
在hive shell :
add jar /path/to/iceberg-hive-runtime.jar;
2,设置参数:
在hive shell :
SET abled=true;
abled=true;
atalog=hive;
3,创建hive表:
在hive shell 客户端执⾏:
CREATE EXTERNAL TABLE test.iceberg_hive(
`id` int,
`name` string)
STORED BY 'org.hive.HiveIcebergStorageHandler'
LOCATION 'hdfs://bi-524:8020/tmp/warehou/test/iceberg_hive'
TBLPROPERTIES (
'atalog'='hadoop',
'atalog.hadoop.warehou.location'='hdfs://bi-524:8020/tmp/warehou/test/iceberg_hive' );
其实我爱你注意:这⾥的hdfs地址⼀定要精确到 catalog地址 / 库 / 表
感恩父母的演讲稿
如果执⾏不报错,成功的话,我们可以去hdfs web端看到效果:重要的的英语
4,向iceberg插⼊数据验证
zeppelin执⾏:
INSERT INTO st.iceberg_hive values(2, 'c');
凉拌莲藕片的做法5,hive查询