mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +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)
|
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;
|
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;
|
size_t value_size = src_offsets[i] - prev_src_offset;
|
||||||
/// Number of characters in rows of the array, including zero/null bytes.
|
/// Number of characters in strings of the array, including zero bytes.
|
||||||
size_t sum_chars_size = value_size == 0 ? 0 : (src_string_offsets[prev_src_offset + value_size - 1] - prev_src_string_offset);
|
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)
|
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;
|
size_t prev_src_string_offset_local = prev_src_string_offset;
|
||||||
for (size_t k = 0; k < value_size; ++k)
|
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;
|
size_t chars_size = src_string_offsets[k + prev_src_offset] - prev_src_string_offset_local;
|
||||||
|
|
||||||
current_res_string_offset += chars_size;
|
current_res_string_offset += chars_size;
|
||||||
|
@ -88,7 +88,7 @@ void ColumnString::insertRangeFrom(const IColumn & src, size_t start, size_t len
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_t old_size = offsets.size();
|
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);
|
offsets.resize(old_size + length);
|
||||||
|
|
||||||
for (size_t i = 0; i < length; ++i)
|
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());
|
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 offsets_column;
|
||||||
|
|
||||||
ColumnPtr column_first_array_ptr;
|
ColumnPtr column_first_array_ptr;
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include <Columns/ColumnAggregateFunction.h>
|
#include <Columns/ColumnAggregateFunction.h>
|
||||||
#include <Columns/ColumnArray.h>
|
#include <Columns/ColumnArray.h>
|
||||||
#include <Columns/ColumnConst.h>
|
#include <Columns/ColumnConst.h>
|
||||||
#include <Columns/ColumnFunction.h>
|
|
||||||
#include <Columns/ColumnVector.h>
|
#include <Columns/ColumnVector.h>
|
||||||
#include <DataTypes/DataTypeAggregateFunction.h>
|
#include <DataTypes/DataTypeAggregateFunction.h>
|
||||||
#include <DataTypes/DataTypeArray.h>
|
#include <DataTypes/DataTypeArray.h>
|
||||||
@ -14,6 +13,7 @@
|
|||||||
#include <Functions/IFunction.h>
|
#include <Functions/IFunction.h>
|
||||||
#include <Common/typeid_cast.h>
|
#include <Common/typeid_cast.h>
|
||||||
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
namespace ErrorCodes
|
namespace ErrorCodes
|
||||||
|
Loading…
Reference in New Issue
Block a user