Merge pull request #46569 from ClickHouse/add-bug

Fix processing Const(LowCardinality) in arrayMap
This commit is contained in:
Kruglov Pavel 2023-02-21 13:11:06 +01:00 committed by GitHub
commit 36870f0801
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 0 deletions

View File

@ -7,6 +7,7 @@
#include <Columns/ColumnFunction.h>
#include <Columns/ColumnMap.h>
#include <Columns/ColumnNullable.h>
#include <Columns/ColumnLowCardinality.h>
#include <Columns/IColumn.h>
#include <Common/Exception.h>
@ -393,9 +394,15 @@ public:
replicated_column_function->appendArguments(arrays);
auto lambda_result = replicated_column_function->reduce();
/// Convert LowCardinality(T) -> T and Const(LowCardinality(T)) -> Const(T),
/// because we removed LowCardinality from return type of lambda expression.
if (lambda_result.column->lowCardinality())
lambda_result.column = lambda_result.column->convertToFullColumnIfLowCardinality();
if (const auto * const_column = checkAndGetColumnConst<ColumnLowCardinality>(lambda_result.column.get()))
lambda_result.column = const_column->removeLowCardinality();
if (Impl::needBoolean())
{
/// If result column is Nothing or Nullable(Nothing), just create const UInt8 column with 0 value.

View File

@ -0,0 +1 @@
SELECT arrayMap(x -> (toLowCardinality(1) + 1::Nullable(UInt8)), [1]);