mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
Miscellanous changes in ColumnArray (#4857)
* Miscellanous * Miscellanous * Miscellanous
This commit is contained in:
parent
0dee8cf79c
commit
254369324b
@ -809,12 +809,12 @@ ColumnPtr ColumnArray::replicateString(const Offsets & replicate_offsets) const
|
||||
|
||||
for (size_t i = 0; i < col_size; ++i)
|
||||
{
|
||||
/// How much to replicate the array.
|
||||
/// How many times to replicate the array.
|
||||
size_t size_to_replicate = replicate_offsets[i] - prev_replicate_offset;
|
||||
/// The number of rows in the array.
|
||||
/// The number of strings in the array.
|
||||
size_t value_size = src_offsets[i] - prev_src_offset;
|
||||
/// Number of characters in rows of the array, including zero/null bytes.
|
||||
size_t sum_chars_size = value_size == 0 ? 0 : (src_string_offsets[prev_src_offset + value_size - 1] - prev_src_string_offset);
|
||||
/// Number of characters in strings of the array, including zero bytes.
|
||||
size_t sum_chars_size = src_string_offsets[prev_src_offset + value_size - 1] - prev_src_string_offset; /// -1th index is Ok, see PaddedPODArray.
|
||||
|
||||
for (size_t j = 0; j < size_to_replicate; ++j)
|
||||
{
|
||||
@ -824,7 +824,7 @@ ColumnPtr ColumnArray::replicateString(const Offsets & replicate_offsets) const
|
||||
size_t prev_src_string_offset_local = prev_src_string_offset;
|
||||
for (size_t k = 0; k < value_size; ++k)
|
||||
{
|
||||
/// Size of one string.
|
||||
/// Size of single string.
|
||||
size_t chars_size = src_string_offsets[k + prev_src_offset] - prev_src_string_offset_local;
|
||||
|
||||
current_res_string_offset += chars_size;
|
||||
|
@ -88,7 +88,7 @@ void ColumnString::insertRangeFrom(const IColumn & src, size_t start, size_t len
|
||||
else
|
||||
{
|
||||
size_t old_size = offsets.size();
|
||||
size_t prev_max_offset = old_size ? offsets.back() : 0;
|
||||
size_t prev_max_offset = offsets.back(); /// -1th index is Ok, see PaddedPODArray
|
||||
offsets.resize(old_size + length);
|
||||
|
||||
for (size_t i = 0; i < length; ++i)
|
||||
|
@ -161,6 +161,10 @@ public:
|
||||
|
||||
const auto * column_function = typeid_cast<const ColumnFunction *>(column_with_type_and_name.column.get());
|
||||
|
||||
if (!column_function)
|
||||
throw Exception("First argument for function " + getName() + " must be a function.",
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
|
||||
ColumnPtr offsets_column;
|
||||
|
||||
ColumnPtr column_first_array_ptr;
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include <Columns/ColumnAggregateFunction.h>
|
||||
#include <Columns/ColumnArray.h>
|
||||
#include <Columns/ColumnConst.h>
|
||||
#include <Columns/ColumnFunction.h>
|
||||
#include <Columns/ColumnVector.h>
|
||||
#include <DataTypes/DataTypeAggregateFunction.h>
|
||||
#include <DataTypes/DataTypeArray.h>
|
||||
@ -14,6 +13,7 @@
|
||||
#include <Functions/IFunction.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
namespace ErrorCodes
|
||||
|
Loading…
Reference in New Issue
Block a user