Repository navigation
Read Paimon DATE as Date32 instead of Date - #128329
Conversation
Paimon DATE is a signed 32-bit day count, like Iceberg and Delta Lake `date`, which are already read as Date32. Paimon::DataType::parse mapped it to Date, whose range is 1970-01-01 to 2149-06-06, and that type is the requested column type of the data-file reader. One value outside that range made every query that reads the column fail: Code: 321. DB::Exception: Input value -1 is out of allowed Date range, which is [0, 65535] ... (VALUE_IS_OUT_OF_RANGE_OF_DATA_TYPE) while file() on the same Parquet file infers Date32 and reads it. Map DATE to Date32 at the parse site. Every Paimon surface (paimon* table functions, Paimon* engines, the paimon_rest DataLakeCatalog, the partition pruner key) takes its type from there. Partition values were already read as a signed Int32 (getInt), which is the Date32 representation, and partition directory names are built from that raw day count, so pruning and paths are unchanged. Persisted Paimon* tables reload their columns from the Paimon schema on every query, so they switch to Date32 without DDL. Paimon is experimental, so the mapping is corrected without a compatibility setting, as was done for BOOLEAN (ClickHouse#119404). The new test reads pypaimon-written tables with the Date and Date32 bounds and the days just outside the Date range (nullable, NOT NULL, ARRAY<DATE>), the same kind of rows in ORC and Avro, and a table partitioned by DATE with partitions before 1970 and after 2149, including a pruning check. The type expectations of the existing Paimon tests are updated. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Date32 covers 0000-01-01 .. 9999-12-31 since 26.8, so the fixture's previous 1900-01-01 and 2299-12-31 rows were not its bounds. Regenerate t_parquet with the real bounds (day numbers -719528 and 2932896), which are also the bounds of Paimon DATE. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review (2 rounds)
|
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-41:20261030-233000 |
|
Workflow [PR], commit [d488099] Summary: ❌
AI ReviewSummaryPR #128329 maps Paimon Missing context / blind spots
Final VerdictStatus: ✅ Approve |
|
cc @JiaQiTang98 @hanfei1991, could you review this and add the |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units31 translation units recompiled, 318 s compile time in total, 31 of them have a recent master baseline. |
The flaky check runs a changed test many times concurrently against one server. 03701 copied its fixture into the shared user_files/data_minio/paimon_no_partition, so concurrent `cp -r` calls raced on the same destination and failed with `cp: cannot create regular file ... File exists` (1 of 250 runs in `Stateless tests (amd_asan_ubsan, flaky check)`; 2 of 50 locally with `--test-runs 50 --jobs 16`). Copy into CLICKHOUSE_USER_FILES_UNIQUE and remove it at the end, as 04749 already does. The reference is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI finish ledger - 888ed62Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
CIDB has no other Session id: cron:our-pr-ci-monitor:20261031-163004 |
CI finish ledger - d488099Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
CIDB has no other Session id: cron:our-pr-ci-monitor:20261101-133004 |
5109533
Closes: #128306
Related: #128295
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Paimon
DATEcolumns are now read asDate32instead ofDate, like Iceberg and Delta Lake, so dates before 1970-01-01 or after 2149-06-06 are read instead of failing withVALUE_IS_OUT_OF_RANGE_OF_DATA_TYPE.DESCRIBEandtoTypeNamenow reportDate32. Closes #128306.Description
Reading a Paimon table fails with
VALUE_IS_OUT_OF_RANGE_OF_DATA_TYPE(Input value -1 is out of allowed Date range) as soon as aDATEcolumn holds a day before 1970-01-01 or after 2149-06-06, whilefile()on the same data file returns the rows. Found by the data lake fuzzer of #128295 (spark_paimon).Paimon::DataType::parsemappedDATEtoDate, and that is the type the Parquet, ORC and Avro readers are asked to produce, so they enforce theDaterange. PaimonDATEis a signed 32-bit day count, which Iceberg and Delta Lake already read asDate32.The change maps
DATEtoDate32at that single site. Table functions, engines, thepaimon_restcatalog and the partition pruner take their types from it, andARRAY/MAPelements follow. Partition values were already read as a signedInt32, theDate32representation, and partition directory names are built from the raw day count, so pruning and paths need no change. PersistedPaimon*tables reload their columns from the Paimon schema on every query. The documented type mapping is updated in both doc strings. Paimon is experimental, so the mapping is corrected without a compatibility setting, as #119404 did forBOOLEAN.The new test reads pypaimon-written tables (generator in the fixture README) with the
DateandDate32bounds,NOT NULL,ARRAY<DATE>, ORC and Avro, and a table partitioned byDATEwith partitions before 1970 and after 2149, including a pruning check byEngineFileLikeReadFiles. It fails on master with code 321 and passes with the fix (50/50 with random settings). The type expectations of the existing Paimon stateless and integration tests are updated;test_types,test_reader_compatandtest_partition_pruning_typesoftest_storage_paimon_with_sparkpass locally.Workflow [PR]
Sync PR [sync-upstream/pr/128329]
Version info
26.11.1.1061-master(included in26.11and later)