mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
better casts to ColumnNullable
This commit is contained in:
parent
6fe4640e0b
commit
65c0d23efa
@ -3,7 +3,6 @@
|
||||
#include <Common/NaNUtils.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Columns/ColumnNullable.h>
|
||||
#include <Columns/ColumnConst.h>
|
||||
#include <DataStreams/ColumnGathererStream.h>
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <Columns/IColumn.h>
|
||||
#include <Columns/ColumnsNumber.h>
|
||||
#include <Columns/ColumnConst.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
|
||||
|
||||
@ -145,4 +146,20 @@ private:
|
||||
|
||||
ColumnPtr makeNullable(const ColumnPtr & column);
|
||||
|
||||
inline const ColumnNullable * getNullableColumn(const IColumn & column)
|
||||
{
|
||||
const IColumn * ptr = &column;
|
||||
if (auto * const_column = typeid_cast<const ColumnConst *>(ptr))
|
||||
ptr = &const_column->getDataColumn();
|
||||
|
||||
return typeid_cast<const ColumnNullable *>(ptr);
|
||||
}
|
||||
|
||||
inline ColumnNullable & getNullableColumnRef(IColumn & column)
|
||||
{
|
||||
if (auto * const_column = typeid_cast<ColumnConst *>(&column))
|
||||
return static_cast<ColumnNullable &>(const_column->getDataColumn());
|
||||
return static_cast<ColumnNullable &>(column);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ size_t ColumnUnique<ColumnType>::uniqueInsertFrom(const IColumn & src, size_t n)
|
||||
if (is_nullable && src.isNullAt(n))
|
||||
return getNullValueIndex();
|
||||
|
||||
if (auto * nullable = typeid_cast<const ColumnNullable *>(&src))
|
||||
if (auto * nullable = getNullableColumn(src))
|
||||
return uniqueInsertFrom(nullable->getNestedColumn(), n);
|
||||
|
||||
auto ref = src.getDataAt(n);
|
||||
@ -430,7 +430,7 @@ MutableColumnPtr ColumnUnique<ColumnType>::uniqueInsertRangeImpl(
|
||||
return nullptr;
|
||||
};
|
||||
|
||||
if (auto nullable_column = typeid_cast<const ColumnNullable *>(&src))
|
||||
if (auto * nullable_column = getNullableColumn(src))
|
||||
{
|
||||
src_column = typeid_cast<const ColumnType *>(&nullable_column->getNestedColumn());
|
||||
null_map = &nullable_column->getNullMapData();
|
||||
|
@ -30,7 +30,7 @@ ConstantFilterDescription::ConstantFilterDescription(const IColumn & column)
|
||||
|
||||
if (!typeid_cast<const ColumnUInt8 *>(column_nested.get()))
|
||||
{
|
||||
const ColumnNullable * column_nested_nullable = typeid_cast<const ColumnNullable *>(column_nested.get());
|
||||
const ColumnNullable * column_nested_nullable = getNullableColumn(*column_nested);
|
||||
if (!column_nested_nullable || !typeid_cast<const ColumnUInt8 *>(&column_nested_nullable->getNestedColumn()))
|
||||
{
|
||||
throw Exception("Illegal type " + column_nested->getName() + " of column for constant filter. Must be UInt8 or Nullable(UInt8).",
|
||||
@ -60,7 +60,7 @@ FilterDescription::FilterDescription(const IColumn & column_)
|
||||
return;
|
||||
}
|
||||
|
||||
if (const ColumnNullable * nullable_column = typeid_cast<const ColumnNullable *>(&column))
|
||||
if (auto * nullable_column = getNullableColumn(column))
|
||||
{
|
||||
ColumnPtr nested_column = nullable_column->getNestedColumnPtr();
|
||||
MutableColumnPtr mutable_holder = (*std::move(nested_column)).mutate();
|
||||
|
@ -279,11 +279,10 @@ protected:
|
||||
|
||||
for (const auto & col : key_columns)
|
||||
{
|
||||
if (col->isColumnNullable())
|
||||
if (auto * nullable_col = getNullableColumn(*col))
|
||||
{
|
||||
const auto & nullable_col = static_cast<const ColumnNullable &>(*col);
|
||||
actual_columns.push_back(&nullable_col.getNestedColumn());
|
||||
null_maps.push_back(&nullable_col.getNullMapColumn());
|
||||
actual_columns.push_back(&nullable_col->getNestedColumn());
|
||||
null_maps.push_back(&nullable_col->getNullMapColumn());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -544,7 +544,7 @@ void DataTypeLowCardinality::serializeBinaryBulkWithMultipleStreams(
|
||||
ErrorCodes::LOGICAL_ERROR);
|
||||
}
|
||||
|
||||
if (auto nullable_keys = typeid_cast<const ColumnNullable *>(keys.get()))
|
||||
if (auto * nullable_keys = getNullableColumn(*keys))
|
||||
keys = nullable_keys->getNestedColumnPtr();
|
||||
|
||||
bool need_additional_keys = !keys->empty();
|
||||
|
@ -64,18 +64,14 @@ static Block createBlockWithNestedColumnsImpl(const Block & block, const std::un
|
||||
{
|
||||
res.insert({nullptr, nested_type, col.name});
|
||||
}
|
||||
else if (col.column->isColumnNullable())
|
||||
else if (auto * nullable = getNullableColumn(*col.column))
|
||||
{
|
||||
const auto & nested_col = static_cast<const ColumnNullable &>(*col.column).getNestedColumnPtr();
|
||||
const auto & nested_col = nullable->getNestedColumnPtr();
|
||||
|
||||
res.insert({nested_col, nested_type, col.name});
|
||||
}
|
||||
else if (col.column->isColumnConst())
|
||||
{
|
||||
const auto & nested_col = static_cast<const ColumnNullable &>(
|
||||
static_cast<const ColumnConst &>(*col.column).getDataColumn()).getNestedColumnPtr();
|
||||
|
||||
res.insert({ ColumnConst::create(nested_col, col.column->size()), nested_type, col.name});
|
||||
if (col.column->isColumnConst())
|
||||
res.insert({ ColumnConst::create(nested_col, col.column->size()), nested_type, col.name});
|
||||
else
|
||||
res.insert({nested_col, nested_type, col.name});
|
||||
}
|
||||
else
|
||||
throw Exception("Illegal column for DataTypeNullable", ErrorCodes::ILLEGAL_COLUMN);
|
||||
|
@ -92,7 +92,7 @@ void FunctionModelEvaluate::executeImpl(Block & block, const ColumnNumbers & arg
|
||||
materialized_columns.push_back(full_column);
|
||||
columns.back() = full_column.get();
|
||||
}
|
||||
if (auto * col_nullable = typeid_cast<const ColumnNullable *>(columns.back()))
|
||||
if (auto * col_nullable = getNullableColumn(*columns.back()))
|
||||
{
|
||||
if (!null_map)
|
||||
null_map = col_nullable->getNullMapColumnPtr();
|
||||
|
@ -111,10 +111,10 @@ ColumnPtr wrapInNullable(const ColumnPtr & src, const Block & block, const Colum
|
||||
|
||||
if (src->onlyNull())
|
||||
return src;
|
||||
else if (src->isColumnNullable())
|
||||
else if (auto * nullable = getNullableColumn(*src))
|
||||
{
|
||||
src_not_nullable = static_cast<const ColumnNullable &>(*src).getNestedColumnPtr();
|
||||
result_null_map_column = static_cast<const ColumnNullable &>(*src).getNullMapColumnPtr();
|
||||
src_not_nullable = nullable->getNestedColumnPtr();
|
||||
result_null_map_column = nullable->getNullMapColumnPtr();
|
||||
}
|
||||
|
||||
for (const auto & arg : args)
|
||||
@ -130,9 +130,9 @@ ColumnPtr wrapInNullable(const ColumnPtr & src, const Block & block, const Colum
|
||||
if (elem.column->isColumnConst())
|
||||
continue;
|
||||
|
||||
if (elem.column->isColumnNullable())
|
||||
if (auto * nullable = getNullableColumn(*elem.column))
|
||||
{
|
||||
const ColumnPtr & null_map_column = static_cast<const ColumnNullable &>(*elem.column).getNullMapColumnPtr();
|
||||
const ColumnPtr & null_map_column = nullable->getNullMapColumnPtr();
|
||||
if (!result_null_map_column)
|
||||
{
|
||||
result_null_map_column = null_map_column;
|
||||
|
@ -100,13 +100,12 @@ void FunctionArrayDistinct::executeImpl(Block & block, const ColumnNumbers & arg
|
||||
IColumn & res_data = res.getData();
|
||||
ColumnArray::Offsets & res_offsets = res.getOffsets();
|
||||
|
||||
const ColumnNullable * nullable_col = nullptr;
|
||||
const ColumnNullable * nullable_col = getNullableColumn(src_data);
|
||||
|
||||
const IColumn * inner_col;
|
||||
|
||||
if (src_data.isColumnNullable())
|
||||
if (nullable_col)
|
||||
{
|
||||
nullable_col = static_cast<const ColumnNullable *>(&src_data);
|
||||
inner_col = &nullable_col->getNestedColumn();
|
||||
}
|
||||
else
|
||||
|
@ -157,14 +157,12 @@ void FunctionArrayEnumerateExtended<Derived>::executeImpl(Block & block, const C
|
||||
|
||||
for (size_t i = 0; i < num_arguments; ++i)
|
||||
{
|
||||
if (data_columns[i]->isColumnNullable())
|
||||
if (auto * nullable_col = getNullableColumn(*data_columns[i]))
|
||||
{
|
||||
const auto & nullable_col = static_cast<const ColumnNullable &>(*data_columns[i]);
|
||||
|
||||
if (num_arguments == 1)
|
||||
data_columns[i] = &nullable_col.getNestedColumn();
|
||||
data_columns[i] = &nullable_col->getNestedColumn();
|
||||
|
||||
null_map = &nullable_col.getNullMapData();
|
||||
null_map = &nullable_col->getNullMapData();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -154,14 +154,12 @@ void FunctionArrayUniq::executeImpl(Block & block, const ColumnNumbers & argumen
|
||||
|
||||
for (size_t i = 0; i < num_arguments; ++i)
|
||||
{
|
||||
if (data_columns[i]->isColumnNullable())
|
||||
if (auto * nullable_col = getNullableColumn(*data_columns[i]))
|
||||
{
|
||||
const auto & nullable_col = static_cast<const ColumnNullable &>(*data_columns[i]);
|
||||
|
||||
if (num_arguments == 1)
|
||||
data_columns[i] = &nullable_col.getNestedColumn();
|
||||
data_columns[i] = &nullable_col->getNestedColumn();
|
||||
|
||||
null_map = &nullable_col.getNullMapData();
|
||||
null_map = &nullable_col->getNullMapData();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -392,16 +392,15 @@ void FunctionEmptyArrayToSingle::executeImpl(Block & block, const ColumnNumbers
|
||||
const IColumn * inner_col;
|
||||
IColumn * inner_res_col;
|
||||
|
||||
bool nullable = src_data.isColumnNullable();
|
||||
if (nullable)
|
||||
auto nullable_col = getNullableColumn(src_data);
|
||||
if (nullable_col)
|
||||
{
|
||||
auto nullable_col = static_cast<const ColumnNullable *>(&src_data);
|
||||
inner_col = &nullable_col->getNestedColumn();
|
||||
src_null_map = &nullable_col->getNullMapData();
|
||||
|
||||
auto nullable_res_col = static_cast<ColumnNullable *>(&res_data);
|
||||
inner_res_col = &nullable_res_col->getNestedColumn();
|
||||
res_null_map = &nullable_res_col->getNullMapData();
|
||||
auto & nullable_res_col = getNullableColumnRef(res_data);
|
||||
inner_res_col = &nullable_res_col.getNestedColumn();
|
||||
res_null_map = &nullable_res_col.getNullMapData();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -409,7 +408,7 @@ void FunctionEmptyArrayToSingle::executeImpl(Block & block, const ColumnNumbers
|
||||
inner_res_col = &res_data;
|
||||
}
|
||||
|
||||
if (nullable)
|
||||
if (nullable_col)
|
||||
FunctionEmptyArrayToSingleImpl::executeDispatch<true>(*inner_col, src_offsets, *inner_res_col, res_offsets, src_null_map, res_null_map);
|
||||
else
|
||||
FunctionEmptyArrayToSingleImpl::executeDispatch<false>(*inner_col, src_offsets, *inner_res_col, res_offsets, src_null_map, res_null_map);
|
||||
|
@ -42,11 +42,8 @@ public:
|
||||
const ColumnPtr & col = block.getByPosition(arguments[0]).column;
|
||||
ColumnPtr & res_col = block.getByPosition(result).column;
|
||||
|
||||
if (col->isColumnNullable())
|
||||
{
|
||||
const ColumnNullable & nullable_col = static_cast<const ColumnNullable &>(*col);
|
||||
res_col = nullable_col.getNestedColumnPtr();
|
||||
}
|
||||
if (auto * nullable_col = getNullableColumn(*col))
|
||||
res_col = nullable_col->getNestedColumnPtr();
|
||||
else
|
||||
res_col = col;
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ public:
|
||||
|
||||
/// if last argument is not nullable, result should be also not nullable
|
||||
if (!block.getByPosition(multi_if_args.back()).column->isColumnNullable() && res->isColumnNullable())
|
||||
res = static_cast<const ColumnNullable &>(*res).getNestedColumnPtr();
|
||||
res = getNullableColumn(*res)->getNestedColumnPtr();
|
||||
|
||||
block.getByPosition(result).column = std::move(res);
|
||||
}
|
||||
|
@ -660,7 +660,6 @@ private:
|
||||
{
|
||||
const ColumnWithTypeAndName & arg_cond = block.getByPosition(arguments[0]);
|
||||
bool cond_is_null = arg_cond.column->onlyNull();
|
||||
bool cond_is_nullable = arg_cond.column->isColumnNullable();
|
||||
|
||||
if (cond_is_null)
|
||||
{
|
||||
@ -668,11 +667,11 @@ private:
|
||||
return true;
|
||||
}
|
||||
|
||||
if (cond_is_nullable)
|
||||
if (auto * nullable = getNullableColumn(*arg_cond.column))
|
||||
{
|
||||
Block temporary_block
|
||||
{
|
||||
{ static_cast<const ColumnNullable &>(*arg_cond.column).getNestedColumnPtr(), removeNullable(arg_cond.type), arg_cond.name },
|
||||
{ nullable->getNestedColumnPtr(), removeNullable(arg_cond.type), arg_cond.name },
|
||||
block.getByPosition(arguments[1]),
|
||||
block.getByPosition(arguments[2]),
|
||||
block.getByPosition(result)
|
||||
@ -703,8 +702,8 @@ private:
|
||||
|
||||
static ColumnPtr getNestedColumn(const ColumnPtr & column)
|
||||
{
|
||||
if (column->isColumnNullable())
|
||||
return static_cast<const ColumnNullable &>(*column).getNestedColumnPtr();
|
||||
if (auto * nullable = getNullableColumn(*column))
|
||||
return nullable->getNestedColumnPtr();
|
||||
|
||||
return column;
|
||||
}
|
||||
@ -715,8 +714,8 @@ private:
|
||||
const ColumnWithTypeAndName & arg_then = block.getByPosition(arguments[1]);
|
||||
const ColumnWithTypeAndName & arg_else = block.getByPosition(arguments[2]);
|
||||
|
||||
bool then_is_nullable = typeid_cast<const ColumnNullable *>(arg_then.column.get());
|
||||
bool else_is_nullable = typeid_cast<const ColumnNullable *>(arg_else.column.get());
|
||||
auto * then_is_nullable = getNullableColumn(*arg_then.column);
|
||||
auto * else_is_nullable = getNullableColumn(*arg_else.column);
|
||||
|
||||
if (!then_is_nullable && !else_is_nullable)
|
||||
return false;
|
||||
@ -731,14 +730,14 @@ private:
|
||||
arg_cond,
|
||||
{
|
||||
then_is_nullable
|
||||
? static_cast<const ColumnNullable *>(arg_then.column.get())->getNullMapColumnPtr()
|
||||
? then_is_nullable->getNullMapColumnPtr()
|
||||
: DataTypeUInt8().createColumnConstWithDefaultValue(input_rows_count),
|
||||
std::make_shared<DataTypeUInt8>(),
|
||||
""
|
||||
},
|
||||
{
|
||||
else_is_nullable
|
||||
? static_cast<const ColumnNullable *>(arg_else.column.get())->getNullMapColumnPtr()
|
||||
? else_is_nullable->getNullMapColumnPtr()
|
||||
: DataTypeUInt8().createColumnConstWithDefaultValue(input_rows_count),
|
||||
std::make_shared<DataTypeUInt8>(),
|
||||
""
|
||||
@ -818,7 +817,7 @@ private:
|
||||
{
|
||||
auto arg_else_column = arg_else.column;
|
||||
auto result_column = (*std::move(arg_else_column)).mutate();
|
||||
static_cast<ColumnNullable &>(*result_column).applyNullMap(static_cast<const ColumnUInt8 &>(*arg_cond.column));
|
||||
getNullableColumnRef(*result_column).applyNullMap(static_cast<const ColumnUInt8 &>(*arg_cond.column));
|
||||
block.getByPosition(result).column = std::move(result_column);
|
||||
}
|
||||
else
|
||||
@ -860,7 +859,7 @@ private:
|
||||
{
|
||||
auto arg_then_column = arg_then.column;
|
||||
auto result_column = (*std::move(arg_then_column)).mutate();
|
||||
static_cast<ColumnNullable &>(*result_column).applyNegatedNullMap(static_cast<const ColumnUInt8 &>(*arg_cond.column));
|
||||
getNullableColumnRef(*result_column).applyNegatedNullMap(static_cast<const ColumnUInt8 &>(*arg_cond.column));
|
||||
block.getByPosition(result).column = std::move(result_column);
|
||||
}
|
||||
else
|
||||
|
@ -38,11 +38,11 @@ public:
|
||||
void executeImpl(Block & block, const ColumnNumbers & arguments, size_t result, size_t input_rows_count) override
|
||||
{
|
||||
const ColumnWithTypeAndName & elem = block.getByPosition(arguments[0]);
|
||||
if (elem.column->isColumnNullable())
|
||||
if (auto * nullable = getNullableColumn(*elem.column))
|
||||
{
|
||||
/// Return the negated null map.
|
||||
auto res_column = ColumnUInt8::create(input_rows_count);
|
||||
const auto & src_data = static_cast<const ColumnNullable &>(*elem.column).getNullMapData();
|
||||
const auto & src_data = nullable->getNullMapData();
|
||||
auto & res_data = static_cast<ColumnUInt8 &>(*res_column).getData();
|
||||
|
||||
for (size_t i = 0; i < input_rows_count; ++i)
|
||||
|
@ -38,10 +38,10 @@ public:
|
||||
void executeImpl(Block & block, const ColumnNumbers & arguments, size_t result, size_t) override
|
||||
{
|
||||
const ColumnWithTypeAndName & elem = block.getByPosition(arguments[0]);
|
||||
if (elem.column->isColumnNullable())
|
||||
if (auto * nullable = getNullableColumn(*elem.column))
|
||||
{
|
||||
/// Merely return the embedded null map.
|
||||
block.getByPosition(result).column = static_cast<const ColumnNullable &>(*elem.column).getNullMapColumnPtr();
|
||||
block.getByPosition(result).column = nullable->getNullMapColumnPtr();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -310,7 +310,7 @@ struct AggregationMethodKeysFixed
|
||||
/// If we have a nullable column, get its nested column and its null map.
|
||||
if (has_nullable_keys && key_columns[i]->isColumnNullable())
|
||||
{
|
||||
ColumnNullable & nullable_col = static_cast<ColumnNullable &>(*key_columns[i]);
|
||||
ColumnNullable & nullable_col = getNullableColumnRef(*key_columns[i]);
|
||||
observed_column = &nullable_col.getNestedColumn();
|
||||
null_map = static_cast<ColumnUInt8 *>(&nullable_col.getNullMapColumn());
|
||||
}
|
||||
|
@ -289,8 +289,8 @@ void Join::setSampleBlock(const Block & block)
|
||||
}
|
||||
|
||||
/// We will join only keys, where all components are not NULL.
|
||||
if (key_columns[i]->isColumnNullable())
|
||||
key_columns[i] = &static_cast<const ColumnNullable &>(*key_columns[i]).getNestedColumn();
|
||||
if (auto * nullable = getNullableColumn(*key_columns[i]))
|
||||
key_columns[i] = &nullable->getNestedColumn();
|
||||
}
|
||||
|
||||
if (strictness == ASTTableJoin::Strictness::Asof)
|
||||
@ -1426,8 +1426,8 @@ private:
|
||||
if (changes_bitmap[i])
|
||||
{
|
||||
ColumnPtr column = std::move(columns[i]);
|
||||
if (column->isColumnNullable())
|
||||
column = static_cast<const ColumnNullable &>(*column).getNestedColumnPtr();
|
||||
if (auto * nullable = getNullableColumn(*column))
|
||||
column = nullable->getNestedColumnPtr();
|
||||
else
|
||||
column = makeNullable(column);
|
||||
|
||||
|
@ -9,32 +9,30 @@ void extractNestedColumnsAndNullMap(ColumnRawPtrs & key_columns, ColumnPtr & nul
|
||||
if (key_columns.size() == 1)
|
||||
{
|
||||
auto & column = key_columns[0];
|
||||
if (!column->isColumnNullable())
|
||||
return;
|
||||
|
||||
const ColumnNullable & column_nullable = static_cast<const ColumnNullable &>(*column);
|
||||
null_map = &column_nullable.getNullMapData();
|
||||
column = &column_nullable.getNestedColumn();
|
||||
if (auto * column_nullable = getNullableColumn(*column))
|
||||
{
|
||||
null_map = &column_nullable->getNullMapData();
|
||||
column = &column_nullable->getNestedColumn();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto & column : key_columns)
|
||||
{
|
||||
if (column->isColumnNullable())
|
||||
if (auto * column_nullable = getNullableColumn(*column))
|
||||
{
|
||||
const ColumnNullable & column_nullable = static_cast<const ColumnNullable &>(*column);
|
||||
column = &column_nullable.getNestedColumn();
|
||||
column = &column_nullable->getNestedColumn();
|
||||
|
||||
if (!null_map_holder)
|
||||
{
|
||||
null_map_holder = column_nullable.getNullMapColumnPtr();
|
||||
null_map_holder = column_nullable->getNullMapColumnPtr();
|
||||
}
|
||||
else
|
||||
{
|
||||
MutableColumnPtr mutable_null_map_holder = (*std::move(null_map_holder)).mutate();
|
||||
|
||||
PaddedPODArray<UInt8> & mutable_null_map = static_cast<ColumnUInt8 &>(*mutable_null_map_holder).getData();
|
||||
const PaddedPODArray<UInt8> & other_null_map = column_nullable.getNullMapData();
|
||||
const PaddedPODArray<UInt8> & other_null_map = column_nullable->getNullMapData();
|
||||
for (size_t i = 0, size = mutable_null_map.size(); i < size; ++i)
|
||||
mutable_null_map[i] |= other_null_map[i];
|
||||
|
||||
|
@ -73,10 +73,9 @@ typename SetVariantsTemplate<Variant>::Type SetVariantsTemplate<Variant>::choose
|
||||
|
||||
for (const auto & col : key_columns)
|
||||
{
|
||||
if (col->isColumnNullable())
|
||||
if (auto * nullable = getNullableColumn(*col))
|
||||
{
|
||||
const ColumnNullable & nullable_col = static_cast<const ColumnNullable &>(*col);
|
||||
nested_key_columns.push_back(&nullable_col.getNestedColumn());
|
||||
nested_key_columns.push_back(&nullable->getNestedColumn());
|
||||
has_nullable_key = true;
|
||||
}
|
||||
else
|
||||
|
@ -78,11 +78,10 @@ protected:
|
||||
|
||||
for (const auto & col : key_columns)
|
||||
{
|
||||
if (col->isColumnNullable())
|
||||
if (auto * nullable = getNullableColumn(*col))
|
||||
{
|
||||
const auto & nullable_col = static_cast<const ColumnNullable &>(*col);
|
||||
actual_columns.push_back(&nullable_col.getNestedColumn());
|
||||
null_maps.push_back(&nullable_col.getNullMapColumn());
|
||||
actual_columns.push_back(&nullable->getNestedColumn());
|
||||
null_maps.push_back(&nullable->getNullMapColumn());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -276,7 +276,7 @@ bool SetIndexCondition::mayBeTrueOnGranule(MergeTreeIndexGranulePtr idx_granule)
|
||||
|
||||
const NullMap * null_map = nullptr;
|
||||
|
||||
if (auto * col_nullable = typeid_cast<const ColumnNullable *>(column.get()))
|
||||
if (auto * col_nullable = getNullableColumn(*column))
|
||||
{
|
||||
col_uint8 = typeid_cast<const ColumnUInt8 *>(&col_nullable->getNestedColumn());
|
||||
null_map = &col_nullable->getNullMapData();
|
||||
|
Loading…
Reference in New Issue
Block a user