You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
accurateCastOrDefault doesn't work with Array/Tuple/Map types #61982
comp-regular-functionRegular scalar functions: string processing, data conversion, arithmetic, math, comparison, condi...unexpected behaviourResult is unexpected, but not entirely wrong at the same time.
From the first glance it sounds not so difficult: add CastType::accurateCastOrDefault and process it in FunctionsConversion almost in the same way as CastType::accurateCastOrNull.
hostname :) select groupArray(name) from system.codecs;
┌─groupArray(name)───────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
1. │ ['GCD','AES_128_GCM_SIV','FPC','LZ4','AES_256_GCM_SIV','DoubleDelta','Gorilla','NONE','Multiple','LZ4HC','T64','Delta','ZSTD'] │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
hostname :) set aggregate_functions_null_for_empty = 1;
Ok.
hostname :) select groupArray(name) from system.codecs;
Received exception from server (version 25.9.2):
Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Nested type Array(String) cannot be inside Nullable type. (ILLEGAL_TYPE_OF_ARGUMENT)
comp-regular-functionRegular scalar functions: string processing, data conversion, arithmetic, math, comparison, condi...unexpected behaviourResult is unexpected, but not entirely wrong at the same time.
Activity
Avogar commentedon Mar 27, 2024
The problem is -
accurateCastOrDefaultis implemented by converting type toNullableand usingaccurateCastOrNull. We should reimplement it.CurtizJ commentedon Mar 27, 2024
Previously it was closed with
st-wontfix: #31440Avogar commentedon Mar 27, 2024
From the first glance it sounds not so difficult: add
CastType::accurateCastOrDefaultand process it inFunctionsConversionalmost in the same way asCastType::accurateCastOrNull.tobia commentedon Jun 17, 2024
The fact that both are unavailable means that one cannot check whether a cast would work before doing it.
Is there any other way to test if a value can be casted to another, when both accurateCastOrDefault and accurateCastOrNull are unavailable?
For instance, how can I test which strings in a given table can be safely casted to a specific array type?
theory commentedon Nov 12, 2025
EDIT: Ah, my comment dupes #38738
FWIW, aggregate_functions_null_for_empty triggers this behavior, as well: