-- 语法CREATE [EXTERNAL] TABLE table_nameENGINE = ICEBERG[COMMENT "comment"]PROPERTIES ("iceberg.database" = "iceberg_db_name","iceberg.table" = "icberg_table_name","iceberg.hive.metastore.uris" = "thrift://192.168.0.1:9083","iceberg.catalog.type" = "HIVE_CATALOG");-- 例子1:挂载 Iceberg 中 iceberg_db 下的 iceberg_tableCREATE TABLE `t_iceberg`ENGINE = ICEBERGPROPERTIES ("iceberg.database" = "iceberg_db","iceberg.table" = "iceberg_table","iceberg.hive.metastore.uris" = "thrift://192.168.0.1:9083","iceberg.catalog.type" = "HIVE_CATALOG");-- 例子2:挂载 Iceberg 中 iceberg_db 下的 iceberg_table,HDFS开启HACREATE TABLE `t_iceberg`ENGINE = ICEBERGPROPERTIES ("iceberg.database" = "iceberg_db","iceberg.table" = "iceberg_table","iceberg.hive.metastore.uris" = "thrift://192.168.0.1:9083","iceberg.catalog.type" = "HIVE_CATALOG","dfs.nameservices"="HDFS8000463","dfs.ha.namenodes.HDFS8000463"="nn2,nn1","dfs.namenode.rpc-address.HDFS8000463.nn2"="172.21.16.5:4007","dfs.namenode.rpc-address.HDFS8000463.nn1"="172.21.16.26:4007","dfs.client.failover.proxy.provider.HDFS8000463"="org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider");
-- 语法CREATE DATABASE db_name[COMMENT "comment"]PROPERTIES ("iceberg.database" = "iceberg_db_name","iceberg.hive.metastore.uris" = "thrift://192.168.0.1:9083","iceberg.catalog.type" = "HIVE_CATALOG");-- 例子:挂载 Iceberg 中的 iceberg_db,同时挂载该 db 下的所有 tableCREATE DATABASE `iceberg_test_db`PROPERTIES ("iceberg.database" = "iceberg_db","iceberg.hive.metastore.uris" = "thrift://192.168.0.1:9083","iceberg.catalog.type" = "HIVE_CATALOG");
iceberg_test_db
中的建表进度可以通过 HELP SHOW TABLE CREATION
查看。-- 语法CREATE [EXTERNAL] TABLE table_name (col_name col_type [NULL | NOT NULL] [COMMENT "comment"]) ENGINE = ICEBERG[COMMENT "comment"]PROPERTIES ("iceberg.database" = "iceberg_db_name","iceberg.table" = "icberg_table_name","iceberg.hive.metastore.uris" = "thrift://192.168.0.1:9083","iceberg.catalog.type" = "HIVE_CATALOG");-- 例子1:挂载 Iceberg 中 iceberg_db 下的 iceberg_tableCREATE TABLE `t_iceberg` (`id` int NOT NULL COMMENT "id number",`name` varchar(10) NOT NULL COMMENT "user name") ENGINE = ICEBERGPROPERTIES ("iceberg.database" = "iceberg_db","iceberg.table" = "iceberg_table","iceberg.hive.metastore.uris" = "thrift://192.168.0.1:9083","iceberg.catalog.type" = "HIVE_CATALOG");-- 例子2:挂载 Iceberg 中 iceberg_db 下的 iceberg_table,HDFS开启HACREATE TABLE `t_iceberg` (`id` int NOT NULL COMMENT "id number",`name` varchar(10) NOT NULL COMMENT "user name") ENGINE = ICEBERGPROPERTIES ("iceberg.database" = "iceberg_db","iceberg.table" = "iceberg_table","iceberg.hive.metastore.uris" = "thrift://192.168.0.1:9083","iceberg.catalog.type" = "HIVE_CATALOG","dfs.nameservices"="HDFS8000463","dfs.ha.namenodes.HDFS8000463"="nn2,nn1","dfs.namenode.rpc-address.HDFS8000463.nn2"="172.21.16.5:4007","dfs.namenode.rpc-address.HDFS8000463.nn1"="172.21.16.26:4007","dfs.client.failover.proxy.provider.HDFS8000463"="org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider");
iceberg.hive.metastore.uris
:Hive Metastore 服务地址。iceberg.database
:挂载 Iceberg 对应的数据库名。iceberg.table
:挂载 Iceberg 对应的表名,挂载 Iceberg database 时无需指定。iceberg.catalog.type
:Iceberg 中使用的 catalog 方式,默认为 HIVE_CATALOG
,当前仅支持该方式,后续会支持更多的 Iceberg catalog 接入方式。SHOW CREATE TABLE
查看。REFRESH
命令手动同步,该命令会将 Doris 中的 Iceberg 外表删除重建,具体帮助可以通过 HELP REFRESH
查看。-- 同步 Iceberg 表REFRESH TABLE t_iceberg;-- 同步 Iceberg 数据库REFRESH DATABASE iceberg_test_db;
Iceberg | Doris | 描述 |
BOOLEAN | BOOLEAN | - |
INTEGER | INT | - |
LONG | BIGINT | - |
FLOAT | FLOAT | - |
DOUBLE | DOUBLE | - |
DATE | DATE | - |
TIMESTAMP | DATETIME | Timestamp 转成 Datetime 会损失精度 |
STRING | STRING | - |
UUID | VARCHAR | 使用 VARCHAR 来代替 |
DECIMAL | DECIMAL | - |
TIME | - | 不支持 |
FIXED | - | 不支持 |
BINARY | - | 不支持 |
STRUCT | - | 不支持 |
LIST | - | 不支持 |
MAP | - | 不支持 |
REFRESH
命令同步 Iceberg 外表或数据库。select * from t_iceberg where k1 > 1000 and k3 ='term' or k4 like '%doris';
fe.conf
来配置,也可以通过 ADMIN SET CONFIG
来配置。iceberg_table_creation_strict_mode
创建 Iceberg 表默认开启 strict mode。strict mode 是指对 Iceberg 表的列类型进行严格过滤,如果有 Doris 目前不支持的数据类型,则创建外表失败。iceberg_table_creation_interval_second
自动创建 Iceberg 表的后台任务执行间隔,默认为 10s。max_iceberg_table_creation_record_size
Iceberg 表创建记录保留的最大值,默认为 2000。仅针对创建 Iceberg 数据库记录。
本页内容是否解决了您的问题?