Skip to content

[Bug]: Iceberg DATE predicates return empty result on unpartitioned tables #27209

Closed

Description

@Ariznawlll

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main

Commit ID

b7125ed

Other Environment Information

- Branch: main
- Commit: b7125edccd610e96039bd84b0213a2beb6583877
- Topology: local 1 CN + 1 TN + 1 LogService, DISK-V2
- External catalog: Nessie 0.108.4 + MinIO; Oracle: Spark 3.5.1 + Iceberg 1.6.1; Iceberg format v2 / Parquet

Actual Behavior

For a supported, unpartitioned Iceberg DATE column, a full scan and an id predicate are correct, but DATE equality and range predicates silently return no rows.

Three independently created tables all produced:

SELECT COUNT(*), SUM(id) WHERE id=1                     => 1, 1
SELECT COUNT(*), SUM(id) WHERE x = DATE '2000-02-29'  => 0, NULL
SELECT COUNT(*), SUM(id) WHERE x >= DATE '2000-01-01' AND x < DATE '2021-01-01' => 0, NULL

No SQL error, panic, restart, or connection loss occurred.

Expected Behavior

The DATE equality and range predicates must return the same rows as Spark: both queries above select (id=1, x=2000-02-29), therefore COUNT(*)=1, SUM(id)=1. MatrixOne must not silently discard valid rows.

Steps to Reproduce

1. Use Spark against the same Nessie REST catalog and MinIO warehouse to create an Iceberg v2 Parquet table:

CREATE TABLE tiera.type_min1.date (id BIGINT, x DATE) USING iceberg TBLPROPERTIES ('format-version'='2');
INSERT INTO tiera.type_min1.date VALUES
  (1, DATE '2000-02-29'), (2, DATE '2024-02-29'), (3, NULL);

2. In MatrixOne, create the normal REST catalog/access mapping and the external table:

CREATE EXTERNAL TABLE date_t (id BIGINT, x DATE) ENGINE=ICEBERG WITH (
  'catalog'='type_min_cat', 'namespace'='type_min1', 'table'='date',
  'ref'='main', 'read_mode'='append_only', 'write_mode'='read_only'
);

3. Run the ID control, DATE equality and DATE range queries shown in Actual Behavior.
4. Repeat with separately created `type_min2.date` and `type_min3.date` tables.

Additional information

Scope / controls:

  • Spark reads all three source rows and returns the expected one-row equality/range result.
  • MatrixOne full scan returns all three rows; WHERE id=1 is correct.
  • NULL predicate remains correct (WHERE x IS NULL => id 3).
  • The same result occurs on three fresh tables, not only through an Iceberg years(date) partition.

Related: #27200 is a narrower years(date) partition-pruning failure. This report is not a duplicate: it reproduces with an unpartitioned DATE column and therefore points to DATE predicate evaluation/pushdown more generally.

Regression suggestion: deterministic Spark/Nessie/MinIO scenario with leap-date equality, half-open range, NULL and ID controls; three independent tables or fresh snapshots; assert against Spark. No big-data data set is needed.

Activity

  1. added
    kind/bug
    on Aug 17, 2026
  2. iamlinjunhong commented on Sep 7, 2026

    @iamlinjunhong
    Contributor

    Verified on current upstream main 6eee64625e7e2cefd0f3dfeb61606f637111e057: this issue is already fixed by #27205 (f2146c824efed0085f9bf727186484b4d0f17554).

    The reported revision passes MO's internal absolute-day DATE value directly into Iceberg pruning. #27205 converts it to days since 1970-01-01 at the common literal-conversion boundary, so the correction applies to unpartitioned file/row-group pruning as well as year-partition pruning.

    Added and ran a local regression on branch m-27209 using an unpartitioned table with (1, DATE '2000-02-29'), (2, DATE '2024-02-29'), (3, NULL). Actual COUNT(*), SUM(id) results:

    Predicate Result
    Full scan 3, 6
    id = 1 1, 1
    obs_date = DATE '2000-02-29' 1, 1
    obs_date >= DATE '2000-01-01' AND obs_date < DATE '2021-01-01' 1, 1
    obs_date IS NULL 1, 3
    obs_date = DATE '2000-03-01' 0, NULL
    obs_date >= DATE '2024-02-29' 1, 2

    Validation passed: existing DATE epoch-normalization unit test, the local E2E runner's package tests, and all 9 Nessie/MinIO/MatrixOne E2E cases, including the new unpartitioned DATE case. The E2E run used isolated local ports and the current-main service binary.

    Scope: this run used the existing local harness to create the Iceberg table and insert rows through MatrixOne; it did not repeat the Spark-seeded three-table differential test. The additional regression changes are currently local and have not been pushed. Leaving closure to the issue owner.

  3. added
    ai-easy
    on Sep 7, 2026
  4. Ariznawlll commented on Sep 10, 2026

    @Ariznawlll
    CollaboratorAuthor

    QA 独立验收通过(最新 main 269d59addd032d20897cc4d86f58de3e387a6d76)。

    环境与数据源:使用隔离的 Nessie REST + MinIO,外部 PyIceberg 客户端创建无分区 Iceberg 表并写入 (1, DATE 2000-02-29)、(2, DATE 2024-02-29)、(3, NULL);先由外部客户端读回三行,再由 MatrixOne 建立 REST catalog/access mapping 和 ICEBERG 外表读取。

    以下断言连续 3 轮一致通过:

    • 全表:COUNT,SUM(id) = 3,6;id=1 控制组:1,1。
    • x = DATE 2000-02-29:1,1。
    • x >= DATE 2000-01-01 AND x < DATE 2021-01-01:1,1。
    • x IS NULL:1,3。
    • 不存在日期 DATE 2000-03-01:0,NULL。
    • x >= DATE 2024-02-29:1,2。

    这覆盖了原 issue 的等值与范围 DATE 谓词、ID 控制、NULL 及不存在值负向场景;未出现静默空结果、SQL 错误、panic 或连接中断。修复由 #27205 提供,当前 main 验收结论:通过。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ai-easykind/bugphase/testing

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions