Apache Doris 集成 Iceberg 与 Paimon:基于 Docker Compose 的湖仓一体查询实战指南

Apache Doris 集成 Iceberg 与 Paimon:基于 Docker Compose 的湖仓一体查询实战指南

导读

本文以 samples/datalake/iceberg_and_paimon 示例为骨架,完整讲解如何用一套 Docker Compose 环境同时拉起 Apache Doris、Apache Iceberg、Apache Paimon、Flink、Spark 与 MinIO,并在 Flink 中建表、Spark 灌数后,通过 Doris 的 Multi-Catalog 直接查询湖上数据。读完本文,你将掌握:一键启动湖仓一体验证环境的完整流程、Doris 创建 Iceberg/Paimon Catalog 的配置方法、以及如何用 explain verbose 验证 Doris 对 Paimon 的分区裁剪(partition pruning)与原生读取(native read),并亲自验证 Doris 对 Paimon Deletion Vector 的正确处理。

一、示例环境概览:一套 Compose 拉起完整的湖仓链路

示例位于仓库 samples/datalake/iceberg_and_paimon,通过 docker-compose.yml 编排了以下容器与服务:

服务容器名镜像作用
dorisdoris-iceberg-paimon-dorismysql:8.0.18运行 Apache Doris FE/BE(以 MySQL 客户端镜像为宿主)
iceberg-restdoris-iceberg-paimon-iceberg-resttabulario/iceberg-rest提供 Iceberg REST Catalog 服务
paimon/iceberg 元数据复用 jobmanagerflink:1.18.0Flink JobManager 同时承担 Paimon Catalog 初始化
flinkdoris-iceberg-paimon-jobmanager / taskmanagerflink:1.18.0Flink SQL 客户端、JobManager/TaskManager
sparkdoris-iceberg-paimon-sparktabulario/spark-icebergSpark SQL(同时挂载 Paimon 插件)
miniodoris-iceberg-paimon-miniominio/minioS3 兼容对象存储,作为统一的湖上数据仓库
mcdoris-iceberg-paimon-mcminio/mc初始化 warehouse bucket 并设为 public

环境变量与端口在 docker-compose.env 中定义:

REST_CATALOG_PORT=18181
MINIO_UI_PORT=19002
MINIO_API_PORT=19001
DORIS_QUERY_PORT=19031

从 docker-compose.yml 可见,Iceberg REST 服务通过 CATALOG_WAREHOUSE=s3://warehouse/wh/、CATALOG_S3_ENDPOINT=http://minio:9000 指向 MinIO;MinIO 容器还通过网络别名 warehouse.minio 暴露,模拟真实 S3 域名访问场景。整套环境的数据仓库统一落在 MinIO 的 s3://warehouse/ 路径下,Doris、Flink、Spark 共享同一份数据文件,这正是湖仓一体(Lakehouse)的核心形态——一份数据、多种引擎读写。

二、一键启动:环境参数、依赖下载与初始化流程

2.1 启动前环境参数

由于启动的组件包含 Elasticsearch 类依赖对内存映射数量的要求(示例脚本沿用该检查),需要先调整宿主机的内核参数:

sysctl -w vm.max_map_count=2000000

该参数通常以 root 权限执行,重启后失效;如需持久化可写入 /etc/sysctl.conf。

2.2 启动脚本做了什么

执行 bash start_all.sh 即可完成全部启动、建表与灌数:

bash start_all.sh

从 start_all.sh 源码看,脚本依次完成四件事:

  1. 下载依赖包:通过 download_source_file() 函数按 MD5 校验下载 Doris 2.1.5 二进制包、JDK 8u202、Iceberg/Paimon 的 Flink 与 Spark 连接器 JAR 等,已存在且 MD5 匹配的文件会跳过(断点续传式准备)。
  2. 解压准备:将 Doris 包解压为 packages/doris-bin,JDK 解压为 packages/jdk1.8.0_202,并汇总 JAR 到 packages/jars。
  3. 拉起容器:sudo docker compose -f docker-compose.yml --env-file docker-compose.env up -d。
  4. 初始化表与数据:
    • docker exec doris-iceberg-paimon-jobmanager sql-client.sh -f /opt/flink/sql/init_tables.sql 在 Flink 中创建 Iceberg 表与 Paimon 表;
    • docker exec doris-iceberg-paimon-spark spark-sql -f /opt/sql/prepare_data.sql 用 Spark 将 TPC-H customer 样例数据灌入 Paimon 表。

启动成功后脚本会打印四组客户端入口提示:Doris、Flink、Spark for Paimon、Spark for Iceberg。

2.3 Doris 容器内的启动逻辑

值得说明的是,Doris 容器本身以 mysql:8.0.18 为宿主镜像,真正的 FE/BE 进程由 scripts/start_doris.sh 驱动:

  • 将 /opt/doris-bin 复制为 /opt/doris;
  • 清空 FE 元数据与 BE 存储目录后,分别以 --daemon 方式启动 start_fe.sh 与 start_be.sh;
  • 轮询 fe.log 中 QE service start. 关键字,等待 FE 就绪;
  • 通过 mysql 客户端执行 sql/init_doris.sql,完成 BE 注册与两个外部 Catalog 的创建;
  • 最后 tail -F /dev/null 保持容器前台运行。

停止环境则使用:

bash stop_all.sh

对应 stop_all.sh 中的 docker compose ... down。

三、表结构初始化:Flink 侧的 Iceberg 与 Paimon 建表

start_all.sh 启动阶段实际执行的建表 SQL 是 sql/init_tables.sql,其中包含两个 Catalog 的创建:

SET 'sql-client.execution.result-mode' = 'tableau';
SET 'execution.runtime-mode' = 'batch';

-- Iceberg REST Catalog
CREATE CATALOG iceberg WITH (
  'type'='iceberg',
  'catalog-type'='rest',
  'uri'='http://rest:8181/',
  's3.endpoint'='http://minio:9000',
  'warehouse'='s3://warehouse/wh/'
);

-- Paimon Catalog(文件系统 + S3)
CREATE CATALOG `paimon` WITH (
  'type' = 'paimon',
  'warehouse' = 's3://warehouse/wh',
  's3.endpoint'='http://minio:9000',
  's3.access-key' = 'admin',
  's3.secret-key' = 'password',
  's3.region' = 'us-east-1'
);

3.1 Iceberg 表(merge-on-read 模式)

CREATE TABLE if not exists iceberg.db_iceberg.tb_iceberg (
    id BIGINT,
    val string,
    PRIMARY KEY (id) NOT ENFORCED
) WITH (
'write.upsert.enabled'='true',
'upsert-enabled'='true',
'write.delete.mode'='merge-on-read',
'write.update.mode'='merge-on-read'
);

这里通过 write.delete.mode='merge-on-read' 与 write.update.mode='merge-on-read' 配置了 Iceberg 的 merge-on-read(MOR)语义:删除与更新不立即重写数据文件,而是记录在独立的 delete file 中,读取时在线合并。这类表是验证 Doris 湖仓查询能力(尤其是 mor 场景)的典型用例。

3.2 Paimon 表(主键表 + Deletion Vector)

CREATE TABLE if not exists paimon.db_paimon.customer (
  `c_custkey` int,
  `c_name` varchar(25),
  `c_address` varchar(40),
  `c_nationkey` int,
  `c_phone` char(15),
  `c_acctbal` decimal(12,2),
  `c_mktsegment` char(10),
  `c_comment` varchar(117),
  PRIMARY KEY (c_custkey, c_nationkey) NOT ENFORCED
) PARTITIONED BY (c_nationkey) WITH (
  'deletion-vectors.enabled' = 'true',
  'bucket'='1'
);

这张 customer 表是后续所有查询验证的主角,其关键特性:

  • 联合主键 (c_custkey, c_nationkey),主键约束 NOT ENFORCED(由 Paimon 在写入层保证);
  • 按 c_nationkey 分区,为后续验证 Doris 分区裁剪埋下伏笔;
  • 开启 Deletion Vector('deletion-vectors.enabled' = 'true'),使主键表在执行 UPDATE/DELETE 时可以采用带删除向量的增量文件方式,而不是全量重写数据文件。

3.3 数据灌入:Spark 读取本地 Parquet 写入 Paimon

sql/prepare_data.sql 通过 Spark 将示例数据写入 Paimon 表:

CREATE TEMPORARY VIEW customer_files
USING org.apache.spark.sql.parquet
OPTIONS (
  path "file:///opt/data/customer/"
);

insert overwrite paimon.db_paimon.customer
select c_custkey, c_name, c_address, c_nationkey, c_phone,
       c_acctbal, c_mktsegment, c_comment
from customer_files;

源数据文件位于 samples/datalake/iceberg_and_paimon/data/table/customer(4 个 Parquet 分片 000000_0 至 000003_0),由 start_all.sh 通过 -v ./data/table:/opt/data 挂载进 Spark 容器。灌数完成后,s3://warehouse/wh/db_paimon.db/customer/ 下会生成按 c_nationkey 分区的数据文件。

四、Paimon 表体验:从 Flink 端查看已建表与数据

4.1 进入 Flink SQL Client

bash start_flink_client.sh

该脚本(start_flink_client.sh)实际执行:

sudo docker exec -it doris-iceberg-paimon-jobmanager sql-client.sh -i /opt/flink/sql/init_tables.sql

注意它使用的是 -i(初始化文件)而非 -f,因此进入交互式客户端的同时会预置两个 Catalog 定义。

4.2 查看已创建的 Paimon 表

Flink SQL> use paimon.db_paimon;
[INFO] Execute statement succeed.

Flink SQL> show tables;
+------------+
| table name |
+------------+
|   customer |
+------------+
1 row in set

Flink SQL> show create table customer;

show create table 返回的建表语句与 3.2 节一致,并带有实际生效的表属性:

CREATE TABLE `paimon`.`db_paimon`.`customer` (
  `c_custkey` INT NOT NULL,
  ...
  CONSTRAINT `PK_c_custkey_c_nationkey` PRIMARY KEY (`c_custkey`, `c_nationkey`) NOT ENFORCED
) PARTITIONED BY (`c_nationkey`)
WITH (
  'bucket' = '1',
  'path' = 's3://warehouse/wh/db_paimon.db/customer',
  'deletion-vectors.enabled' = 'true'
)

这里可以看到 Paimon 表实际数据落在 MinIO 的 s3://warehouse/wh/db_paimon.db/customer 路径,与 Doris 侧 Catalog 的 warehouse 指向完全一致——这正是两套系统能共享同一份数据的前提。

4.3 查看表结构与数据

Flink SQL> desc customer;

列信息如下(PRI(c_custkey, c_nationkey) 标注联合主键):

nametypenullkey
c_custkeyINTFALSEPRI(c_custkey, c_nationkey)
c_nameVARCHAR(25)TRUE
c_addressVARCHAR(40)TRUE
c_nationkeyINTFALSEPRI(c_custkey, c_nationkey)
c_phoneCHAR(15)TRUE
c_acctbalDECIMAL(12, 2)TRUE
c_mktsegmentCHAR(10)TRUE
c_commentVARCHAR(117)TRUE

数据(TPC-H customer 集,共 149987 行):

Flink SQL> select * from customer order by c_custkey limit 4;

+-----------+--------------------+--------------------------------+-------------+-----------------+-----------+--------------+--------------------------------+
| c_custkey |             c_name |                      c_address | c_nationkey |         c_phone | c_acctbal | c_mktsegment |                      c_comment |
+-----------+--------------------+--------------------------------+-------------+-----------------+-----------+--------------+--------------------------------+
|         1 | Customer#000000001 |              IVhzIApeRb ot,c,E |          15 | 25-989-741-2988 |    711.56 |     BUILDING | to the even, regular platel... |
|         2 | Customer#000000002 | XSTf4,NCwDVaWNe6tEgvwfmRchLXak |          13 | 23-768-687-3665 |    121.65 |   AUTOMOBILE | l accounts. blithely ironic... |
|         3 | Customer#000000003 |                   MG9kdTD2WBHm |           1 | 11-719-748-3364 |   7498.12 |   AUTOMOBILE |  deposits eat slyly ironic,... |
|        32 | Customer#000000032 | jD2xZzi UmId,DCtNBLXKj9q0Tl... |          15 | 25-430-914-2194 |   3471.53 |     BUILDING | cial ideas. final, furious ... |
+-----------+--------------------+--------------------------------+-------------+-----------------+-----------+--------------+--------------------------------+
4 rows in set

倒序查看则验证数据量上界:

Flink SQL> select * from customer order by c_custkey desc limit 4;

最大 c_custkey 为 149987,与全量 149987 行吻合(TPC-H SF=1 的 customer 表规模),说明数据已完整灌入。

五、通过 Doris 查询 Paimon 表

5.1 进入 Doris 客户端

bash start_doris_client.sh

对应 start_doris_client.sh:

sudo docker exec -it doris-iceberg-paimon-doris sh -c "mysql -u root -h doris -P 9030"

使用 MySQL 协议连接 Doris 的 Query Port(映射到宿主机 19031)。

5.2 直接查询 Paimon Catalog

示例在 Doris 启动时已通过 sql/init_doris.sql 建好两个外部 Catalog,因此无需任何额外配置即可查询:

mysql> use paimon.db_paimon;
Database changed

mysql> show tables;
+---------------------+
| Tables_in_db_paimon |
+---------------------+
| customer            |
+---------------------+
1 row in set (0.00 sec)

mysql> select * from customer order by c_custkey limit 4;

查询结果与 Flink 侧完全一致(Doris 返回完整 c_comment 内容,未截断):

+-----------+--------------------+---------------------------------------+-------------+-----------------+-----------+--------------+--------------------------------------------------------------------------------------------------------+
| c_custkey | c_name             | c_address                             | c_nationkey | c_phone         | c_acctbal | c_mktsegment | c_comment                                                                                              |
+-----------+--------------------+---------------------------------------+-------------+-----------------+-----------+--------------+--------------------------------------------------------------------------------------------------------+
|         1 | Customer#000000001 | IVhzIApeRb ot,c,E                     |          15 | 25-989-741-2988 |    711.56 | BUILDING     | to the even, regular platelets. regular, ironic epitaphs nag e                                         |
|         2 | Customer#000000002 | XSTf4,NCwDVaWNe6tEgvwfmRchLXak        |          13 | 23-768-687-3665 |    121.65 | AUTOMOBILE   | l accounts. blithely ironic theodolites integrate boldly: caref                                        |
|         3 | Customer#000000003 | MG9kdTD2WBHm                          |           1 | 11-719-748-3364 |   7498.12 | AUTOMOBILE   |  deposits eat slyly ironic, even instructions. express foxes detect slyly. blithely even accounts abov |
|        32 | Customer#000000032 | jD2xZzi UmId,DCtNBLXKj9q0Tlp2iQ6ZcO3J |          15 | 25-430-914-2194 |   3471.53 | BUILDING     | cial ideas. final, furious requests across the e                                                       |
+-----------+--------------------+---------------------------------------+-------------+-----------------+-----------+--------------+--------------------------------------------------------------------------------------------------------+
4 rows in set (1.89 sec)

首查耗时约 1.89s(首次访问需解析 Paimon 元数据与 S3 文件清单),后续查询回落到 0.35s 左右,说明元数据已有本地缓存。

六、用 explain verbose 验证分区裁剪与原生读取

Doris 对 Paimon 的查询优化是本示例的核心卖点。执行:

mysql> explain verbose select * from customer where c_nationkey < 3;

关键执行计划片段:

0:VPAIMON_SCAN_NODE(68)
  table: customer
  predicates: (c_nationkey[#3] < 3)
  inputSplitNum=3, totalFileSize=193823, scanRanges=3
  partition=3/0
  backends:
    10002
      s3://warehouse/wh/db_paimon.db/customer/c_nationkey=1/bucket-0/data-15cee5b7-1bd7-42ca-9314-56d92c62c03b-0.orc start: 0 length: 66600
      s3://warehouse/wh/db_paimon.db/customer/c_nationkey=2/bucket-0/data-e98fb7ef-ec2b-4ad5-a496-713cb9481d56-0.orc start: 0 length: 64059
      s3://warehouse/wh/db_paimon.db/customer/c_nationkey=0/bucket-0/data-431be05d-50fa-401f-9680-d646757d0f95-0.orc start: 0 length: 63164
  cardinality=18751, numNodes=1
  pushdown agg=NONE
  paimonNativeReadSplits=3/3
  PaimonSplitStats:
    SplitStat [type=NATIVE, rowCount=771, rawFileConvertable=true, hasDeletionVector=false]
    SplitStat [type=NATIVE, rowCount=750, rawFileConvertable=true, hasDeletionVector=false]
    SplitStat [type=NATIVE, rowCount=750, rawFileConvertable=true, hasDeletionVector=false]

从计划可以确认两件事:

  1. 分区裁剪生效:谓词 c_nationkey < 3 下推后,Doris 只扫描 c_nationkey=0/1/2 三个分区的 3 个数据文件(inputSplitNum=3),共 193823 字节,partition=3/0 表示扫描 3 个分区、跳过 0 个;而 customer 表共有 22 个国家分区(c_nationkey 0~21),其余分区文件完全没有被触碰。
  2. 原生读取(native read)生效:paimonNativeReadSplits=3/3 表示 3 个 Split 全部走 Paimon 原生读取路径,SplitStat 中 type=NATIVE;rawFileConvertable=true 表明底层文件是可直接按 raw 文件解析的 ORC 格式。

计划中的 Tuple/SlotDescriptor 部分同时展示了列裁剪结果:只保留查询用到的 8 列,Paimon 的 VARCHAR 在 Doris 侧映射为 TEXT,DECIMAL(12,2) 映射为 DECIMALV3(12,2)。

从 BE 源码角度看,Doris 对 Paimon 的原生读取由 be/src/vec/exec/format/table/paimon_reader.cpp 等扫描器实现,VPAIMON_SCAN_NODE 属于 Nereids 规划器生成的外表扫描节点;SplitStat 中的 NATIVE 类型即标识该 Split 可由 Doris 直接解析底层列存文件,而非回退到 JNI/第三方引擎读取。

七、验证 Doris 对 Paimon Deletion Vector 的支持

Paimon 主键表开启 deletion-vectors.enabled 后,UPDATE/DELETE 产生的新文件会携带删除向量,读取时须将删除的行过滤掉。Doris 对这一能力的支持可通过下面的实验完整验证。

7.1 通过 Flink 修改数据

回到 Flink 客户端,对 c_nationkey = 1 的分区执行 UPDATE:

Flink SQL> update customer set c_address='c_address_update' where c_nationkey = 1;
[INFO] Submitting SQL update statement to the cluster...
[INFO] SQL update statement has been successfully submitted to the cluster:
Job ID: ff838b7b778a94396b332b0d93c8f7ac

等待作业完成后(可在 Flink Web UI http://localhost:8082 观察),Paimon 会在 c_nationkey=1 分区下追加一个携带删除向量的新数据文件。

7.2 在 Doris 端观察执行计划变化

再次查看同一查询的执行计划:

0:VPAIMON_SCAN_NODE(68)
  table: customer
  predicates: (c_nationkey[#3] < 3)
  inputSplitNum=4, totalFileSize=238324, scanRanges=4
  partition=3/0
  backends:
    10002
      s3://warehouse/wh/db_paimon.db/customer/c_nationkey=1/bucket-0/data-15cee5b7-1bd7-42ca-9314-56d92c62c03b-0.orc start: 0 length: 66600
      s3://warehouse/wh/db_paimon.db/customer/c_nationkey=1/bucket-0/data-5d50255a-2215-4010-b976-d5dc656f3444-0.orc start: 0 length: 44501
      s3://warehouse/wh/db_paimon.db/customer/c_nationkey=2/bucket-0/data-e98fb7ef-ec2b-4ad5-a496-713cb9481d56-0.orc start: 0 length: 64059
      s3://warehouse/wh/db_paimon.db/customer/c_nationkey=0/bucket-0/data-431be05d-50fa-401f-9680-d646757d0f95-0.orc start: 0 length: 63164
  cardinality=18751, numNodes=1
  pushdown agg=NONE
  paimonNativeReadSplits=4/4
  PaimonSplitStats:
    SplitStat [type=NATIVE, rowCount=1542, rawFileConvertable=true, hasDeletionVector=true]
    SplitStat [type=NATIVE, rowCount=750, rawFileConvertable=true, hasDeletionVector=false]
    SplitStat [type=NATIVE, rowCount=750, rawFileConvertable=true, hasDeletionVector=false]

与 UPDATE 之前对比,变化非常清晰:

  • c_nationkey=1 分区下多了一个新文件 data-5d50255a-...-0.orc(44501 字节),Split 总数从 3 变为 4,totalFileSize 从 193823 增至 238324;
  • 新 Split 的 SplitStat 中 hasDeletionVector=true,rowCount 变为 1542(旧文件 771 行 + 新文件 771 行);
  • 4 个 Split 仍全部是 type=NATIVE(paimonNativeReadSplits=4/4),即 Doris 在原生读取路径上识别并应用了删除向量,而不是把过滤逻辑回退给外部引擎。

BE 侧对该能力的实现可从 be/src/util/deletion_vector.h 与 be/src/vec/exec/format/table/paimon_reader.cpp 中印证:Paimon 原生读取器会解析 Split 携带的 deletion vector,在读取数据文件时跳过已删除的行。

7.3 在 Doris 端读取修改后的数据

mysql> select * from customer where c_nationkey=1 limit 2;
+-----------+--------------------+-----------------+-------------+-----------------+-----------+--------------+--------------------------------------------------------------------------------------------------------+
| c_custkey | c_name             | c_address       | c_nationkey | c_phone         | c_acctbal | c_mktsegment | c_comment                                                                                              |
+-----------+--------------------+-----------------+-------------+-----------------+-----------+--------------+--------------------------------------------------------------------------------------------------------+
|         3 | Customer#000000003 | c_address_update |           1 | 11-719-748-3364 |   7498.12 | AUTOMOBILE   |  deposits eat slyly ironic, even instructions. express foxes detect slyly. blithely even accounts abov |
|       513 | Customer#000000513 | c_address_update |           1 | 11-861-303-6887 |    955.37 | HOUSEHOLD    | press along the quickly regular instructions. regular requests against the carefully ironic s          |
+-----------+--------------------+-----------------+-------------+-----------------+-----------+--------------+--------------------------------------------------------------------------------------------------------+
2 rows in set (0.19 sec)

c_address 已全部更新为 c_address_update,说明 Doris 正确完成了删除向量的过滤与新旧文件的数据合并,读到的是 UPDATE 之后的最终一致视图。

八、Iceberg 表的验证入口

示例环境同时创建了 Iceberg 表 iceberg.db_iceberg.tb_iceberg(merge-on-read 模式),对应的验证入口:

  • Flink 侧:在 Flink SQL Client 中 use iceberg.db_iceberg; 查看/操作该表;
  • Doris 侧:mysql> use iceberg.db_iceberg; 直接查询;
  • Spark 侧:
bash start_spark_iceberg_client.sh    # 进入 Iceberg 的 Spark SQL
bash start_spark_paimon_client.sh     # 进入 Paimon 的 Spark SQL

两个脚本(start_spark_iceberg_client.sh、start_spark_paimon_client.sh)分别以 IcebergSparkSessionExtensions 和 PaimonSparkSessionExtensions 扩展名启动 spark-sql,用于读写对应格式的表。

Doris 侧 Iceberg Catalog 的创建方式与 Paimon 完全一致,同样来自 sql/init_doris.sql,只是 "type" = "iceberg" 且使用 REST Catalog 类型:

CREATE CATALOG `iceberg` PROPERTIES (
    "type" = "iceberg",
    "iceberg.catalog.type" = "rest",
    "uri"="http://rest:8181",
    "warehouse" = "s3://warehouse/",
    "s3.endpoint"="http://minio:9000",
    "s3.access_key"="admin",
    "s3.secret_key"="password",
    "s3.region"="us-east-1"
);

对 Iceberg merge-on-read 表的行级删除/更新场景,可参照第七节 Paimon 的验证思路,用 explain verbose 观察 Doris 是否生成包含 delete file 合并逻辑的执行计划。

九、扩展:手动在 Doris 中创建 Paimon Catalog

如果你不在该 Compose 环境内、或想在自己的 Doris 集群上复用这套验证方式,可以直接执行 sql/init_doris.sql 中的建 Catalog 语句。其要点如下:

配置项示例值说明
typepaimonCatalog 类型,必须为 paimon
warehouses3://warehouse/wh/Paimon Warehouse 根路径,须与写入端(Flink)一致
s3.endpointhttp://minio:9000S3 兼容对象存储地址;生产环境替换为真实 S3/OSS/OSS-HDFS 等
s3.access_keyadmin对象存储访问密钥
s3.secret_keypassword对象存储访问密钥
s3.regionus-east-1对象存储区域

前提条件:Doris BE 需要能够访问到该对象存储(网络可达、密钥正确),且 Doris 版本支持 Paimon Catalog(示例使用 Apache Doris 2.1.5 二进制包,见 start_all.sh 中的 DORIS_PACKAGE 定义)。若对象存储使用虚拟主机风格域名,可参考 MinIO 容器配置的 MINIO_DOMAIN=minio 别名方式保证域名可解析。

创建成功后即可像访问普通库表一样执行 use paimon.db_paimon;、show tables;、select ...,并获得本文第六、七节展示的分区裁剪、原生读取与 Deletion Vector 支持。

总结

通过 samples/datalake/iceberg_and_paimon 示例,我们完整走通了"Flink 建表 → Spark 灌数 → Doris 查询"的湖仓一体链路,并借助 explain verbose 从执行计划层面实证了 Doris 的两项关键能力:

  1. 分区裁剪:谓词下推后只读取命中分区的数据文件;
  2. 原生读取 + Deletion Vector:以 NATIVE 方式直接解析 Paimon 底层列存文件,并在原生路径上正确应用删除向量,保证读取到主键表 UPDATE/DELETE 后的正确数据。

这套环境同时覆盖 Iceberg(REST Catalog + merge-on-read)与 Paimon 两种主流湖格式,可作为开发、测试与 Demo 演示的快速验证平台。

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值