Repository navigation
Closed
Description
Got this exception on arm once.
Code: 170. DB::Exception: Received from localhost:9000. DB::Exception: Received from clickhouse3:9000. DB::Exception: Bad get: has Int64, requested Decimal64: While executing ReadFromObjectStorage. (BAD_GET)
(query: SELECT *
FROM database_ede509c8_d48a_11f0_84b0_920006daec54.`namespace_f0865cf6_d48a_11f0_90ed_920006daec54.table_f0865e1a_d48a_11f0_8763_920006daec54` AS t1
RIGHT ANTI JOIN s3('http://minio:9000/warehouse/data1/data/**.parquet', '[masked]:Secret(name='minio_root_user')', '[masked]:Secret(name='minio_root_password')') AS t2
ON t1.timestamp_col = t2.timestamp_col ORDER BY tuple(*) SETTINGS object_storage_cluster_join_mode='allow', object_storage_cluster='replicated_cluster' FORMAT Values
)
Trace:
2025.12.09 00:10:10.568682 [ 1585 ] {dfb617ee-4c2c-43fc-8cdb-7f992d72e501} <Error> executeQuery: Code: 170. DB::Exception: Bad get: has Int64, requested Decimal64: While executing ReadFromObjectStorage. (BAD_GET) (version 25.8.9.20496.altinityantalya (altinity build)) (from 172.18.0.7:59630) (query 1, line 2) (in query: SELECT __table1.boolean_col AS boolean_col, __table1.long_col AS long_col, __table1.double_col AS double_col, __table1.string_col AS string_col, __table1.timestamp_col AS timestamp_col, __table1.date_col AS date_col, __table1.time_col AS time_col, __table1.timestamptz_col AS timestamptz_col, __table1.integer_col AS integer_col, __table1.float_col AS float_col, __table1.decimal_col AS decimal_col, __table2.boolean_col AS `t2.boolean_col`, __table2.long_col AS `t2.long_col`, __table2.double_col AS `t2.double_col`, __table2.string_col AS `t2.string_col`, __table2.timestamp_col AS `t2.timestamp_col`, __table2.date_col AS `t2.date_col`, __table2.time_col AS `t2.time_col`, __table2.timestamptz_col AS `t2.timestamptz_col`, __table2.integer_col AS `t2.integer_col`, __table2.float_col AS `t2.float_col`, __table2.decimal_col AS `t2.decimal_col` FROM icebergS3Cluster('replicated_cluster', 'http://minio:9000/warehouse/data3/', 'admin', '[HIDDEN]', 'Parquet', '`boolean_col` Nullable(Bool), `long_col` Nullable(Int64), `double_col` Nullable(Float64), `string_col` Nullable(String), `timestamp_col` Nullable(DateTime64(6)), `date_col` Nullable(Date), `time_col` Nullable(Int64), `timestamptz_col` Nullable(DateTime64(6, \'UTC\')), `integer_col` Nullable(Int32), `float_col` Nullable(Float32), `decimal_col` Nullable(Decimal(10, 2))', SETTINGS iceberg_metadata_file_path = 'metadata/00004-8104b757-641c-4291-84de-afd9c47886c1.metadata.json') AS __table1 ANTI RIGHT JOIN s3('http://minio:9000/warehouse/data1/data/**.parquet', 'admin', '[HIDDEN]') AS __table2 ON __table1.timestamp_col = __table2.timestamp_col ORDER BY __table1.boolean_col ASC, __table1.long_col ASC, __table1.double_col ASC, __table1.string_col ASC, __table1.timestamp_col ASC, __table1.date_col ASC, __table1.time_col ASC, __table1.timestamptz_col ASC, __table1.integer_col ASC, __table1.float_col ASC, __table1.decimal_col ASC, __table2.boolean_col ASC, __table2.long_col ASC, __table2.double_col ASC, __table2.string_col ASC, __table2.timestamp_col ASC, __table2.date_col ASC, __table2.time_col ASC, __table2.timestamptz_col ASC, __table2.integer_col ASC, __table2.float_col ASC, __table2.decimal_col ASC SETTINGS object_storage_cluster_join_mode = 'allow'), Stack trace (when copying this message, always include the lines below):
0. DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x0000000010cce5b0
1. DB::Exception::Exception(String&&, int, String, bool) @ 0x000000000b76ac98
2. DB::Exception::Exception(PreformattedMessage&&, int) @ 0x000000000b76a768
3. DB::Exception::Exception<std::basic_string_view<char, std::char_traits<char>>, std::basic_string_view<char, std::char_traits<char>>>(int, FormatStringHelperImpl<std::type_identity<std::basic_string_view<char, std::char_traits<char>>>::type, std::type_identity<std::basic_string_view<char, std::char_traits<char>>>::type>, std::basic_string_view<char, std::char_traits<char>>&&, std::basic_string_view<char, std::char_traits<char>>&&) @ 0x0000000013ebefbc
4. DB::NearestFieldTypeImpl<__decay(DB::DateTime64), void>::Type& DB::Field::safeGet<DB::DateTime64>() & @ 0x0000000013ec0344
5. DB::ColumnDecimal<DB::DateTime64>::insert(DB::Field const&) @ 0x000000000b5fee98
6. DB::DataTypeNullable::createColumnConst(unsigned long, DB::Field const&) const @ 0x0000000014236634
7. DB::StorageObjectStorageSource::generate() @ 0x00000000137d8c30
8. DB::ISource::tryGenerate() @ 0x00000000167e836c
9. DB::ISource::work() @ 0x00000000167e7f80
10. DB::ExecutionThreadContext::executeTask() @ 0x0000000016802360
11. DB::PipelineExecutor::executeStepImpl(unsigned long, DB::IAcquiredSlot*, std::atomic<bool>*) @ 0x00000000167f5d70
12. void std::__function::__policy_invoker<void ()>::__call_impl[abi:ne190107]<std::__function::__default_alloc_func<DB::PipelineExecutor::spawnThreads(std::shared_ptr<DB::IAcquiredSlot>)::$_0, void ()>>(std::__function::__policy_storage const*) @ 0x00000000167f94d4
13. ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool::worker() @ 0x0000000010dffa7c
14. void std::__function::__policy_invoker<void ()>::__call_impl[abi:ne190107]<std::__function::__default_alloc_func<ThreadFromGlobalPoolImpl<false, true>::ThreadFromGlobalPoolImpl<void (ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool::*)(), ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool*>(void (ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool::*&&)(), ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool*&&)::'lambda'(), void ()>>(std::__function::__policy_storage const*) @ 0x0000000010e05e60
15. ThreadPoolImpl<std::thread>::ThreadFromThreadPool::worker() @ 0x0000000010dfcfcc
16. void* std::__thread_proxy[abi:ne190107]<std::tuple<std::unique_ptr<std::__thread_struct, std::default_delete<std::__thread_struct>>, void (ThreadPoolImpl<std::thread>::ThreadFromThreadPool::*)(), ThreadPoolImpl<std::thread>::ThreadFromThreadPool*>>(void*) @ 0x0000000010e03fdc
17. ? @ 0x0000000000080398
18. ? @ 0x00000000000e9e9c
2025.12.09 00:10:10.577929 [ 1585 ] {} <Error> TCPHandler: Code: 170. DB::Exception: Bad get: has Int64, requested Decimal64: While executing ReadFromObjectStorage. (BAD_GET), Stack trace (when copying this message, always include the lines below):
0. DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x0000000010cce5b0
1. DB::Exception::Exception(String&&, int, String, bool) @ 0x000000000b76ac98
2. DB::Exception::Exception(PreformattedMessage&&, int) @ 0x000000000b76a768
3. DB::Exception::Exception<std::basic_string_view<char, std::char_traits<char>>, std::basic_string_view<char, std::char_traits<char>>>(int, FormatStringHelperImpl<std::type_identity<std::basic_string_view<char, std::char_traits<char>>>::type, std::type_identity<std::basic_string_view<char, std::char_traits<char>>>::type>, std::basic_string_view<char, std::char_traits<char>>&&, std::basic_string_view<char, std::char_traits<char>>&&) @ 0x0000000013ebefbc
4. DB::NearestFieldTypeImpl<__decay(DB::DateTime64), void>::Type& DB::Field::safeGet<DB::DateTime64>() & @ 0x0000000013ec0344
5. DB::ColumnDecimal<DB::DateTime64>::insert(DB::Field const&) @ 0x000000000b5fee98
6. DB::DataTypeNullable::createColumnConst(unsigned long, DB::Field const&) const @ 0x0000000014236634
7. DB::StorageObjectStorageSource::generate() @ 0x00000000137d8c30
8. DB::ISource::tryGenerate() @ 0x00000000167e836c
9. DB::ISource::work() @ 0x00000000167e7f80
10. DB::ExecutionThreadContext::executeTask() @ 0x0000000016802360
11. DB::PipelineExecutor::executeStepImpl(unsigned long, DB::IAcquiredSlot*, std::atomic<bool>*) @ 0x00000000167f5d70
12. void std::__function::__policy_invoker<void ()>::__call_impl[abi:ne190107]<std::__function::__default_alloc_func<DB::PipelineExecutor::spawnThreads(std::shared_ptr<DB::IAcquiredSlot>)::$_0, void ()>>(std::__function::__policy_storage const*) @ 0x00000000167f94d4
13. ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool::worker() @ 0x0000000010dffa7c
14. void std::__function::__policy_invoker<void ()>::__call_impl[abi:ne190107]<std::__function::__default_alloc_func<ThreadFromGlobalPoolImpl<false, true>::ThreadFromGlobalPoolImpl<void (ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool::*)(), ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool*>(void (ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool::*&&)(), ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true>>::ThreadFromThreadPool*&&)::'lambda'(), void ()>>(std::__function::__policy_storage const*) @ 0x0000000010e05e60
15. ThreadPoolImpl<std::thread>::ThreadFromThreadPool::worker() @ 0x0000000010dfcfcc
16. void* std::__thread_proxy[abi:ne190107]<std::tuple<std::unique_ptr<std::__thread_struct, std::default_delete<std::__thread_struct>>, void (ThreadPoolImpl<std::thread>::ThreadFromThreadPool::*)(), ThreadPoolImpl<std::thread>::ThreadFromThreadPool*>>(void*) @ 0x0000000010e03fdc
17. ? @ 0x0000000000080398
18. ? @ 0x00000000000e9e9c
Activity
alsugiliazova commentedon Dec 9, 2025
SHOW CREATE TABLE `namespace_e380ef31_d511_11f0_923d_e0c26496f172.table_e380ef65_d511_11f0_8a18_e0c26496f172`alsugiliazova commentedon May 4, 2026
Same issue on new version of 25.8 antalya:
alsugiliazova commentedon May 4, 2026
Bug:
Bad get: has Int64, requested Decimal64in Distributed Iceberg JOINComponent:
StorageObjectStorageSource/ Iceberg constant-column optimisationSeverity: Crash (exception, query aborted)
Versions affected: 25.8.x (altinityantalya); likely any build with
allow_experimental_iceberg_read_optimization = trueReproducibility: Intermittent — see Why it does not always happen
Symptom
A distributed
RIGHT ANY JOINbetween an Iceberg (DataLakeCatalog) table and a plains3()table function — usingobject_storage_cluster_join_mode = 'allow'— crashes on a remote cluster node with:Stack frames (condensed):
Failing query shape:
The same query against MergeTree copies of both tables succeeds.
Root Cause
There are two defects that combine to cause the crash.
Defect 1 — Iceberg
timetype maps toInt64; Arrow/Parquet maps it toDateTime64SchemaProcessor.cpp:245–246ArrowColumnToCHColumn.cpp:413–418(Arrow/Parquet reader)The same physical column (
time_col, IcebergTimeType, ParquetINT64 TIME_MICROS) is seen as two different ClickHouse types depending on who reads the schema:Nullable(Int64)s3())Nullable(DateTime64(6))Defect 2 —
WhichDataType::isDecimal()excludesDateTime64In
IDataType.h:413:In
ManifestFile.cpp:67, Iceberg column bound values are deserialised:DateTime64falls into theelsebranch. ButInt64(the type fortime) also falls into theelsebranch and returns aField(Int64). This is correct forInt64-typed columns, but the caller (StorageObjectStorageSource) later pairs thatInt64bound value with a column type ofNullable(DateTime64(6))— which is wrong.How the two defects combine
DataFileMetaInfois built from Iceberg column statistics (using Iceberg schema) on the initiator, then sent to remote nodes viaClusterFunctionReadTask.cpp:103–104. On the remote node the file is processed with aread_from_format_infobuilt from Arrow/Parquet schema inference, not from the Iceberg schema. These two seetime_coldifferently.Why it only fires for
time_col, not for timestamp columnstimestamp_col(IcebergTimestampType) is mapped toDateTime64(6)by both the Iceberg SchemaProcessor and the Arrow reader, so there is no disagreement.time_col(IcebergTimeType) is the only column type mapped toInt64by the Iceberg SchemaProcessor but toDateTime64by Arrow.Why it does not always happen
The crash requires all five conditions to hold simultaneously:
Condition 1 —
allow_experimental_iceberg_read_optimization = trueThis setting (default
true, markedEXPERIMENTALinSettings.cpp) must be enabled. When it isfalse, theconstant_columns_with_valuesoptimisation is entirely skipped:If the setting is disabled in a test run or user config, no crash occurs.
Condition 2 — Iceberg manifest must contain column statistics for
time_colThe bound values (
lower_bounds,upper_bounds) are written into the manifest by the Iceberg writer (pyiceberg in this test). Not all writers include statistics for all column types:TimeType, some pyiceberg versions skip or omit the column statistics if the internal conversion from ParquetINT64 TIME_MICROSbounds to Icebergtimebounds is not implementedlower_bounds/upper_boundsare absent fortime_col,hyperrectangle.has_value()isfalseand the constant-column path is not entered → no crashThis is the primary source of intermittency across different environments or pyiceberg versions.
Condition 3 —
time_colmust be a "point" (min == max) with null_count == 0Both conditions fire only when all values in a file are identical and none are NULL. For the test data (
time(12, 0, 0)repeated for every row, 2 rows per file) this is deterministically true — but only when Condition 2 is also satisfied.Condition 4 — The specific join combination must be exercised
The test runs 675 combinations in parallel (different left/right table types, join clauses, clusters, join conditions). The crash only occurs when:
iceberg_tabletype)s3()table functionobject_storage_cluster_join_mode = 'allow'None(e.g.,replicated_cluster_three_nodes)Only a subset of all 675 combinations satisfies this. If a given test run does not reach the failing combination before a timeout, or if a prior failure in the same parallel batch interrupts the run, the crash does not appear in the output.
Condition 5 — Schema resolution on the remote node takes the Parquet-inference path
With
allowmode, the full JOIN query is sent unchanged to remote nodes (IStorageCluster.cpp:297–298). Each remote node executes the complete query independently. When the remote node reads the Iceberg parquet files received viaClusterFunctionReadTask:DataFileMetaInfo(withtime_colbounds asInt64) comes from the initiatorread_from_format_info.requested_columnsuses the Iceberg schema (Int64) or the Parquet-inferred schema (DateTime64) depends on which code path buildsread_from_format_infoon the remote nodeIf the remote node resolves the Iceberg table via the catalog (using the Iceberg schema,
Int64), there is no mismatch and no crash. If the remote node buildsread_from_format_infofrom the Parquet/Arrow reader (e.g., because it receives a plainObjectInfowithout the full Iceberg catalog context), the mismatch occurs.This path varies depending on how the query is serialised and deserialised across nodes, which can differ between ClickHouse patch versions.
Minimal Reproduction
Proposed Fixes
Fix A — Align Iceberg
timetype mapping with Arrow (recommended)SchemaProcessor.cpp:245This eliminates the type disagreement at the source. It is a semantic change (visible type of
time_colchanges fromInt64toDateTime64(6)) so downstream effects (casting, parquet write-back, comparisons) must be verified.Fix B — Handle
DateTime64/Time64indeserializeFieldFromBinaryReprManifestFile.cpp:67And add the correct deserialization for
DateTime64/Time64inside the block: big-endian 8-byte int64 →DecimalField<DateTime64>. This also fixes the byte-order issue for timestamp bounds (currently read viamemcpywithout endian conversion).Fix C — Defensive guard in
StorageObjectStorageSource(crash prevention)Add a type-compatibility check before inserting into
constant_columns_with_values:This prevents the crash without changing semantics, and logs a warning to aid diagnosis. Should be applied as a short-term patch while Fix A or B is evaluated.
Files to Change
src/Storages/ObjectStorage/DataLakes/Iceberg/SchemaProcessor.cpp:245time→DateTime64(6)instead ofInt64src/Storages/ObjectStorage/DataLakes/Iceberg/ManifestFile.cpp:67DateTime64/Time64; add big-endian handlingsrc/Storages/ObjectStorage/StorageObjectStorageSource.cpp:645constant_columns_with_valuesianton-ru commentedon May 7, 2026
May be this can help: #1731
ianton-ru commentedon Sep 8, 2026
Can't reproduce on actual
antalya-26.6branch.