lceberg Catalog

最近更新时间:2023-10-23 10:46:11

我的收藏
Mutil Catalog Iceberg 提供了 Doris 直接访问 Iceberg 外部表的能力,外部表省去了繁琐的数据导入工作,并借助 Doris 本身的 OLAP 的能力来解决 Iceberg 表的数据分析问题:
支持 Iceberg 数据源接入Doris。
支持 Doris 与 Iceberg 数据源中的表联合查询,进行更加复杂的分析操作。
本文档主要介绍该功能的使用方式和注意事项等。
说明:
该功能适用于 Doris 1.2及后续版本。
支持 Iceberg V1/V2 表格式,V2 格式仅支持 Position Delete 方式,不支持 Equality Delete。

创建方法

数据在 HDFS 上:
CREATE RESOURCE ice_hms_resource PROPERTIES (
'hive.metastore.uris' = 'thrift://172.16.xxxx:7004',
'type' = 'hms',
'dfs.nameservices'='HDFS1005116', 'dfs.ha.namenodes.HDFS1005116'='nn1,nn2',
'dfs.namenode.rpc-address.HDFS1005116.nn1'='172.16.xxxx:4007',
'dfs.namenode.rpc-address.HDFS1005116.nn2'='172.16.xxxx:4007',
'dfs.client.failover.proxy.provider.HDFS1005116'='org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider'
);
数据在 COS 上:
CREATE CATALOG hive_cossab PROPERTIES ( "AWS_ENDPOINT" = "cos.ap-guangzhou.myqcloud.com", "AWS_REGION" = "ap-guangzhou", "AWS_SECRET_KEY" = "Wu9ByN6g4D8seHj0770jxxxxxxx", "use_path_style" = "true", "hive.metastore.uris" = "thrift://172.16.xxxx:7004", "type" = "hms", "AWS_ACCESS_KEY" = "AKIDaWJcCi9Rc4TqjV9hYHn9Nxxxxxxxxx" );

类型匹配

支持的 Iceberg 列类型与 Doris 对应关系如下表:
HMS Type
Doris Type
Comment
boolean
boolean
 -
tinyint
tinyint
 -
smallint
smallint
 -
int
int
 -
bigint
bigint
 -
date
date
 -
timestamp
datetime
 -
float
float
 -
double
double
 -
char
char
 -
varchar
varchar
 -
decimal
decimal
 -
array<type>
array<type>
支持 array 嵌套,如 array<array<int>>
map<KeyType, ValueType>
map<KeyType, ValueType>
暂不支持嵌套,KeyType 和 ValueType 需要为基础类型
struct<col1: Type1, col2: Type2, ...>
struct<col1: Type1, col2: Type2, ...>
暂不支持嵌套,Type1, Type2, ... 需要为基础类型
other
unsupported
 -

Time Travel

支持读取 Iceberg 表指定的 Snapshot。
每一次对 Iceberg 表的写操作都会产生一个新的快照。
默认情况下,读取请求只会读取最新版本的快照。
可以使用 FOR TIME AS OF 和 FOR VERSION AS OF 语句,根据快照 ID 或者快照产生的时间读取历史版本的数据。示例如下:
SELECT * FROM iceberg_tbl FOR TIME AS OF "2022-10-07 17:20:37";
SELECT * FROM iceberg_tbl FOR VERSION AS OF 868895038966572;

查询用法

与普通的 Doris OLAP 表并无区别。
select * from ice_catalog_name.database_name.table_name;