Repository navigation
Description
✅ I checked the Altinity Stable Builds lifecycle table, and the Altinity Stable Build version I'm using is still supported.
Type of problem
Bug report - something's broken
Describe the situation
Since #2239 ("Fix iceberg partition pruning by nanoseconds") was merged into antalya-26.6, min/max pruning no longer works on ordinary Iceberg timestamp columns (ClickHouse DateTime64(6)). A filter such as WHERE ts <= timestamp('2024-03-20 14:00:00') reads every data file instead of skipping the ones whose bounds exclude the predicate.
Query results are still correct. The impact is performance: every file is read, so pruning on timestamp columns is effectively disabled.
This issue:
- Fails
test_minmax_pruning(all 12 parameter combinations) andtest_writes_statistics_by_minmax_pruning(all 6) withassert 0 == 3: 0 files pruned where 3 are expected - Reproduces on every build type that runs integration tests (
amd_tsan,amd_msan,amd_asan_ubsan,arm_binary), on every run, so it is deterministic and not a sanitizer artifact - Was not caught on the PR because Fix iceberg partition pruning by nanoseconds #2239 excluded the ARM and all sanitizer jobs, which skipped every integration job
How to reproduce the behavior
Environment
- Version: 26.6.8.20003.altinityantalya (also every
antalya-26.6build since 2026-10-26) - Build type: any
Steps
cd tests/integration
./runner 'test_storage_iceberg_with_spark/test_minmax_pruning.py::test_minmax_pruning'
./runner 'test_storage_iceberg_no_spark/test_writes_statistics_by_minmax_pruning.py::test_writes_statistics_by_minmax_pruning'Manually: create an Iceberg table with a timestamp column and several data files with non-overlapping ts ranges, then run
SELECT * FROM t WHERE ts <= timestamp('2024-03-20 14:00:00.000000') ORDER BY ALL;
SYSTEM FLUSH LOGS;
SELECT ProfileEvents['IcebergMinMaxIndexPrunedFiles'] FROM system.query_log
WHERE query_id = '<id>' AND type = 'QueryFinish';Expected behavior
Files whose ts lower/upper bounds exclude the predicate are pruned: IcebergMinMaxIndexPrunedFiles = 3 in the test.
Actual behavior
No files are pruned: IcebergMinMaxIndexPrunedFiles = 0.
test_storage_iceberg_with_spark/test_minmax_pruning.py:116: in test_minmax_pruning
E assert 0 == 3
E + where 0 = check_validity_and_get_prunned_files("SELECT * FROM test_minmax_pruning_s3_... WHERE ts <= timestamp('2024-03-20 14:00:00.000000') ORDER BY ALL")
test_storage_iceberg_no_spark/test_writes_statistics_by_minmax_pruning.py:89: in test_writes_statistics_by_minmax_pruning
E assert 0 == 3
Root cause analysis
#2239 added deserializeDateTime64FromBinaryRepr in src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergFieldParseHelpers.cpp, and deserializeFieldFromBinaryRepr now routes every DateTime64 bound through it. For scale 6 it returns std::nullopt unless the raw value exceeds 1e18:
if (scale == 6)
{
if (!magnitudeExceeds(unscaled, nanoseconds_lower_threshold)) // 1e18
return std::nullopt;
unscaled = nanosecondsToMicrosecondsForBound(unscaled, lower_bound);
}A real microsecond timestamp in 2024 is about 1.7e15, so a correctly written timestamp bound always takes the nullopt branch. ManifestFileIterator::processRow then skips the column (if (!left || !right) continue;), and no hyperrectangle is built for it.
The intent was to detect nanosecond statistics mistakenly written into a timestamp column. The fallback for "not nanoseconds" should be to use the value as microseconds, not to drop it:
if (scale == 6 && magnitudeExceeds(unscaled, nanoseconds_lower_threshold))
unscaled = nanosecondsToMicrosecondsForBound(unscaled, lower_bound);
return DecimalField<DateTime64>(DateTime64(unscaled), scale);Whether the (1e16, 1e18] ambiguity mentioned in the code comment still needs a fail-open there is a separate decision. It should not disable pruning for the normal 1970–2286 microsecond range.
Additional context
CI failure
- Jobs:
Integration tests (arm_binary, distributed plan, 3/4)and4/4,Integration tests (amd_tsan, 2/6)and4/6,Integration tests (amd_msan, 4/10)and8/10,Integration tests (amd_asan_ubsan, db disk, old analyzer, 3/8)and4/8 - Branch:
v26.6.8.20003.altinityantalya(tag ofantalya-26.6) - Commit:
07b090420c4daf9c25f83fb52cc4f41996200cba - Run: https://github.com/Altinity/ClickHouse/actions/runs/40906560905
- CI report: ci_run_report.html
Timeline on antalya-26.6 MasterCI
- 2026-10-25 run 40148050191 at
c4e9bc72, before the merge: both tests pass - Fix iceberg partition pruning by nanoseconds #2239 merged 2026-10-25 15:44 UTC
- 2026-10-26 run 40250933654 at
d8c48507, and every run since: both tests fail
Related PR
- Fix iceberg partition pruning by nanoseconds #2239: Fix iceberg partition pruning by nanoseconds. It introduced the change that caused this regression (solves Partition pruning works incorrectly #2240).
Activity