Repository navigation
Description
Description
MatrixOne incorrectly prunes every file for a supported Iceberg table partitioned by years(date). A four-row table is readable without a date predicate, but a range selecting the two 2020 rows returns an empty result instead of the Spark result.
Environment
- Branch:
main - Commit:
1f9e501594509fb5d2e0284833faf8c3426e2285 - Test date:
2026-08-17 - Deployment: local
1 CN + 1 TN + 1 LogService, DISK-V2 - External services: native MinIO
RELEASE.2025-09-06T17-38-46Z+ Nessie0.108.4 - Oracle: Spark
3.5.1, Iceberg1.6.1, JDK21.0.12 - Iceberg table: format v2, Parquet,
PARTITIONED BY (years(obs_date))
Steps to reproduce
Create the table through Spark against the same Nessie catalog and MinIO warehouse:
CREATE TABLE tiera.public_negative.year_partition_tiny (
id BIGINT, obs_date DATE, value BIGINT
) USING iceberg
PARTITIONED BY (years(obs_date))
TBLPROPERTIES ('format-version'='2');
INSERT INTO tiera.public_negative.year_partition_tiny VALUES
(1, DATE '2019-06-01', 10),
(2, DATE '2020-02-01', 20),
(3, DATE '2020-12-31', 30),
(4, DATE '2021-01-01', 40);Create the normal MatrixOne Iceberg catalog/access mapping and map the table with the supported columns:
CREATE EXTERNAL TABLE iceberg_native_verify.year_partition_tiny (
id BIGINT, obs_date DATE, value BIGINT
) ENGINE = ICEBERG WITH (
'catalog'='native_t3',
'namespace'='public_negative',
'table'='year_partition_tiny',
'ref'='main',
'read_mode'='append_only',
'write_mode'='read_only'
);Run the control and the filtered query:
SELECT COUNT(*), SUM(value)
FROM iceberg_native_verify.year_partition_tiny;
SELECT COUNT(*), SUM(value)
FROM iceberg_native_verify.year_partition_tiny
WHERE obs_date >= DATE '2020-01-01'
AND obs_date < DATE '2021-01-01';Actual behavior
The unfiltered control is correct, but the valid 2020 range is silently empty:
control: 4, 100
filtered: 0, NULL
The same filtered query returned 0, NULL in 3/3 fresh executions. No SQL error is returned.
Expected behavior
Spark returns the two 2020 rows:
filtered: 2, 50
MatrixOne must return the same result and must not prune the 2020 partition.
Stability and controls
- Minimal reproducer: 3/3 wrong results with four rows.
- Spark oracle:
2019 => 1/10,2020 => 2/50,2021 => 1/40. - MatrixOne full-scan control: 3/3 returned
4/100. - Unrelated Iceberg identity-partition control: 3/3 returned the expected 10 rows.
- Service health:
SELECT 1continued to succeed; no panic, OOM, or restart observed. - This is not a big-data-only issue.
Evidence
MatrixOne EXPLAIN keeps the date predicate as a residual filter but execution returns no rows:
External Scan on iceberg_native_verify.year_partition_tiny
Iceberg: namespace=public_negative, table=year_partition_tiny, ref=main,
read_mode=append_only, residual_filter=true
The same behavior was also observed on the fixed NOAA 2019/2020 table: Spark returned 359629 / 29072705 for February 2020 TMAX, while MatrixOne returned 0 / NULL 3/3.
Code analysis
The Iceberg specification stores the result of the year transform as years from 1970, not the calendar year. The stable four-row failure is consistent with an incorrect transform-domain comparison during MatrixOne partition pruning. This is a hypothesis; the exact faulty conversion has not yet been confirmed.
Regression coverage
After the fix, add a deterministic Nessie + MinIO external Iceberg scenario containing years 2019/2020/2021. Assert unfiltered, equality, closed/open range, IN, pre-epoch, NULL, and no-match predicates against Spark, repeat 3 times, and preserve an EXPLAIN pruning assertion. No big-data dataset is needed.
Related
- Source feature validation: [Feature Request]: Support External Iceberg Tables #23359
- [Bug]: Spark-generated Iceberg Parquet table fails to read even with one row #27196 is related to signed HTTP/Parquet object reads but is not a duplicate: this issue returns a successful empty result on a four-row table whose unfiltered scan succeeds.
Activity
Ariznawlll commentedon Aug 17, 2026
测试版本
原问题验证
建立按 `years(obs_date)` 分区的 Iceberg 表,使用 Spark oracle 计算 2019、2020、2021、epoch 前日期和 NULL 分组,再映射到 MatrixOne 外部表执行原始 pruning 场景。当前 main 每轮完整扫描为 `6/155`,2020 范围为 `2/50`,与 oracle 一致;没有匹配的范围返回 `0/NULL`。
Happy Path 覆盖
Unhappy Path 覆盖
不适用:该 issue 是合法日期分区 pruning 的错误结果,不要求拒绝输入;未注入 Nessie/MinIO/Spark 故障,也未将外部服务故障误报为产品修复证据。
白盒验证
不适用:问题由外部表服务级 SQL 完整触发,已用独立 Spark oracle 做结果交叉校验;本机 Go cgo 头文件不完整,未把未执行的 Go UT 作为通过依据。
回归测试
测试证据
测试结论
测试通过。