mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
Merge pull request #3751 from abyss7/issues/3583
Fix `RangeHashedDictionary` getter against `ColumnConst`
This commit is contained in:
commit
b6ea2d5396
@ -84,7 +84,7 @@ public:
|
||||
}
|
||||
|
||||
/// If column stores integers, it returns n-th element transformed to UInt64 using static_cast.
|
||||
/// If column stores floting point numbers, bits of n-th elements are copied to lower bits of UInt64, the remaining bits are zeros.
|
||||
/// If column stores floating point numbers, bits of n-th elements are copied to lower bits of UInt64, the remaining bits are zeros.
|
||||
/// Is used to optimize some computations (in aggregation, for example).
|
||||
virtual UInt64 get64(size_t /*n*/) const
|
||||
{
|
||||
|
@ -354,7 +354,9 @@ void RangeHashedDictionary::getItemsImpl(
|
||||
out[i] = static_cast<OutputType>(val_it != std::end(ranges_and_values) ? val_it->value : null_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
out[i] = static_cast<OutputType>(null_value);
|
||||
}
|
||||
}
|
||||
|
||||
query_count.fetch_add(ids.size(), std::memory_order_relaxed);
|
||||
|
@ -1683,20 +1683,21 @@ private:
|
||||
template <typename T>
|
||||
static const PaddedPODArray<T> & getColumnDataAsPaddedPODArray(const IColumn & column, PaddedPODArray<T> & backup_storage)
|
||||
{
|
||||
if (const auto vector_col = checkAndGetColumn<ColumnVector<T>>(&column))
|
||||
if (!column.isColumnConst())
|
||||
{
|
||||
return vector_col->getData();
|
||||
}
|
||||
if (const auto const_col = checkAndGetColumnConstData<ColumnVector<T>>(&column))
|
||||
{
|
||||
return const_col->getData();
|
||||
if (const auto vector_col = checkAndGetColumn<ColumnVector<T>>(&column))
|
||||
{
|
||||
return vector_col->getData();
|
||||
}
|
||||
}
|
||||
|
||||
// With type conversion, need to use backup storage here
|
||||
const auto size = column.size();
|
||||
const auto full_column = column.isColumnConst() ? column.convertToFullColumnIfConst() : column.getPtr();
|
||||
|
||||
// With type conversion and const columns we need to use backup storage here
|
||||
const auto size = full_column->size();
|
||||
backup_storage.resize(size);
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
backup_storage[i] = column.getUInt(i);
|
||||
backup_storage[i] = full_column->getUInt(i);
|
||||
|
||||
return backup_storage;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user