mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-11 17:02:25 +00:00
Fix bad cast in arrayIndex #26330
This commit is contained in:
parent
8a843ae15f
commit
15eb68d117
@ -115,6 +115,13 @@ private:
|
||||
[[maybe_unused]] const NullMap * const null_map_data,
|
||||
[[maybe_unused]] const NullMap * const null_map_item)
|
||||
{
|
||||
if constexpr (std::is_same_v<Data, IColumn> && std::is_same_v<Target, IColumn>)
|
||||
{
|
||||
/// Generic variant is using IColumn::compare function that only allows to compare columns of identical types.
|
||||
if (typeid(data) != typeid(target))
|
||||
throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Columns {} and {} cannot be compared", data.getName(), target.getName());
|
||||
}
|
||||
|
||||
const size_t size = offsets.size();
|
||||
|
||||
result.resize(size);
|
||||
|
2
tests/queries/0_stateless/02010_array_index_bad_cast.sql
Normal file
2
tests/queries/0_stateless/02010_array_index_bad_cast.sql
Normal file
@ -0,0 +1,2 @@
|
||||
-- This query throws exception about uncomparable data types (but at least it does not introduce bad cast in code).
|
||||
SELECT has(materialize(CAST(['2021-07-14'] AS Array(LowCardinality(Nullable(DateTime))))), materialize('2021-07-14'::DateTime64(7))); -- { serverError 44 }
|
Loading…
Reference in New Issue
Block a user