Skip to content

Filter on timestamptz iceberg data returns empty rows (when server timezone is set) #1299

@subkanthi

Description

@subkanthi

Describe the bug
ClickHouse server returns empty rows(Iceberg rest catalog) when the server is set to a different timezone. There was an issue with ice Altinity/ice#85, where the min/max partition values were wrong.

 :) set iceberg_timezone_for_timestamptz ='America/Chicago';

SET iceberg_timezone_for_timestamptz = 'America/Chicago'

Query id: 27156193-fa6b-4dd0-b9e7-7c90d49e085b

Ok.

0 rows in set. Elapsed: 0.002 sec.

 :) select count(*), min(_time), max(_time) from `test.test4`;

SELECT
    count(*),
    min(_time),
    max(_time)
FROM `test.test4`

Query id: 5f2bd8c8-01ca-4323-8fd8-97641dd32afe

   ┌─count()─┬─────────────────min(_time)─┬─────────────────max(_time)─┐
1. │   86400 │ 2025-12-16 00:00:00.000000 │ 2025-12-16 23:59:59.000000 │
   └─────────┴────────────────────────────┴────────────────────────────┘

1 row in set. Elapsed: 0.010 sec. Processed 86.40 thousand rows, 273.82 KB (8.96 million rows/s., 28.39 MB/s.)
Peak memory usage: 822.20 KiB.

:) select count(*), min(_time), max(_time) from `test.test4` where _time >= '2025-12-16 18:05:00' and _time < '2025-12-16 18:10:00' settings use_iceberg_partition_pruning = 1;

SELECT
    count(*),
    min(_time),
    max(_time)
FROM `test.test4`
WHERE (_time >= '2025-12-16 18:05:00') AND (_time < '2025-12-16 18:10:00')
SETTINGS use_iceberg_partition_pruning = 1

Query id: 7296a2d9-e56f-400c-afa0-8ce597e07039

   ┌─count()─┬─────────────────min(_time)─┬─────────────────max(_time)─┐
1. │       0 │ 1969-12-31 18:00:00.000000 │ 1969-12-31 18:00:00.000000 │
   └─────────┴────────────────────────────┴────────────────────────────┘

1 row in set. Elapsed: 0.009 sec.

^^^^ BUG expected 300 got 0

To Reproduce
Steps to reproduce the behavior:

  1. Run clickhouse server in a different timezone, example: America/Chicago
  2. Use ice to insert iceberg data (partitioned by day)
clickhouse local --query "select toDateTime(toDate(now()) + interval number second) as _time, 1 as value from numbers(86400) format Parquet" > test.parquet
./ice insert test.test4 -p test.parquet --partition='[{"column":"_time", "transform": "day"}]'
./ice insert test.test5 -p test.parquet
  1. SET set iceberg_timezone_for_timestamptz ='America/Chicago';

Expected behavior

  • ClickHouse server should be able to retrieve the partition information from iceberg rest catalog and using the partition information, it should be able to filter the results.

Key information

  • Not reproducible in non-antalya build and Spark
dfa6d88178f2 :) select count(*), min(_time), max(_time) from `test.test4` where _time >= '2025-12-19 18:05:00' and _time < '2025-12-19 18:10:00' settings use_iceberg_partition_pruning = 1;

SELECT
    count(*),
    min(_time),
    max(_time)
FROM `test.test4`
WHERE (_time >= '2025-12-19 18:05:00') AND (_time < '2025-12-19 18:10:00')
SETTINGS use_iceberg_partition_pruning = 1

Query id: 4ca84779-c106-40ad-b19a-e0b8d1308544

   ┌─count()─┬─────────────────min(_time)─┬─────────────────max(_time)─┐
1. │     300 │ 2025-12-19 18:05:00.000000 │ 2025-12-19 18:09:59.000000 │
   └─────────┴────────────────────────────┴────────────────────────────┘

1 row in set. Elapsed: 0.025 sec. Processed 86.40 thousand rows, 273.89 KB (3.46 million rows/s., 10.97 MB/s.)
Peak memory usage: 1.39 MiB.

dfa6d88178f2 :) select timezone();

SELECT timezone()

Query id: 48cf05e8-6bbf-4684-a1be-c7f6230477f2

   ┌─timezone()──────┐
1. │ America/Chicago │
   └─────────────────┘

1 row in set. Elapsed: 0.003 sec. 

dfa6d88178f2 :) select version();

SELECT version()

Query id: 701e5317-a481-4fe2-9d28-11d73b18749e

   ┌─version()──┐
1. │ 25.8.14.17 │
   └────────────┘

1 row in set. Elapsed: 0.002 sec. 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions