iceberg命令

iceberg连接
beeline -u jdbc:hive2://IP:10000 -n hdfs

--SET iceberg.engine.hive.enabled=true;

SET spark.sql.catalog.spark_iceberg_hive=org.apache.iceberg.spark.SparkCatalog;
SET spark.sql.catalog.spark_iceberg_hive.type=hive;
SET spark.sql.catalog.spark_iceberg_hive.uri=thrift://IP:8080,thrift://IP:8080;
use spark_iceberg_hive;

SET spark.sql.catalog.spark_iceberg_hadoop=org.apache.iceberg.spark.SparkCatalog;
SET spark.sql.catalog.spark_iceberg_hadoop.type=hadoop;
SET spark.sql.catalog.spark_iceberg_hadoop.warehouse=hdfs://clusterHA/user/hive/iceberg_hadoop;
use spark_iceberg_hadoop;
表创建
创建表
create table T (
id int not null comment '主键id', 
name string, age int, m decimal(12,5)) 
using iceberg comment '测试表2';

创建表
create table T(id int) 
using iceberg 
stored by 'org.apache.iceberg.mr.hive.HiveIcebergStorageHandler';

创建分区表
create table T (
id int comment '主键id',
name string, 
age int, 
regist_ts timestamp) 
using iceberg partitioned by (bucket(16, id), days(regist_ts), name) 
comment '表注释' 
tblproperties ('current-snapshot-id' = 'none','format' = 'iceberg/parquet','format-version' = '1');
显示表结构
desc formatted T;
表编辑
alter table T rename to T2;
alter table T set tblproperties('comment'='表注释2');
alter table T set tblproperties('format-version'='2');
alter table T unset tblproperties('format','format-version');

alter table T drop partition field bucket(16, id);
alter table T drop partition field id;

alter table T add partition field bucket(16,id2);
alter table T add partition field id3;
alter table T replace partition field days(regist_ts) with days(ts);

alter table T add column id bigint after id2 comment '注释';
alter table T drop column id;
alter table T alter column id type long comment '字段注释id';
alter table T alter column id comment '注释';
alter table T alter column id first;
alter table T alter column id after id2;

alter table T alter column id set not null;
alter table T alter column id drop not null;
表索引
create index idx1 on T(id);
posted @   rbcd  阅读(15)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
历史上的今天:
2022-11-22 JVM
2022-11-22 常用
2022-11-22 Hbase
2022-11-22 Zookeeper
2022-11-22 Docker
2022-11-22 Hive
2022-11-22 Idea
点击右上角即可分享
微信分享提示