2012-08-20 05:32:50 +00:00
|
|
|
|
#pragma once
|
2010-05-13 16:17:10 +00:00
|
|
|
|
|
2010-05-13 16:18:26 +00:00
|
|
|
|
#include <string.h> // memcpy
|
|
|
|
|
|
2015-10-05 01:35:28 +00:00
|
|
|
|
#include <DB/Common/Exception.h>
|
2015-10-04 03:20:03 +00:00
|
|
|
|
#include <DB/Common/Arena.h>
|
2016-07-10 15:58:58 +00:00
|
|
|
|
#include <DB/Common/SipHash.h>
|
2010-05-13 16:17:10 +00:00
|
|
|
|
|
|
|
|
|
#include <DB/Columns/IColumn.h>
|
2012-08-26 04:40:29 +00:00
|
|
|
|
#include <DB/Columns/ColumnsNumber.h>
|
2013-07-28 00:35:29 +00:00
|
|
|
|
#include <DB/Columns/ColumnString.h>
|
2010-05-13 16:17:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
|
{
|
|
|
|
|
|
2016-01-11 21:46:36 +00:00
|
|
|
|
namespace ErrorCodes
|
|
|
|
|
{
|
|
|
|
|
extern const int ILLEGAL_COLUMN;
|
|
|
|
|
extern const int NOT_IMPLEMENTED;
|
|
|
|
|
extern const int BAD_ARGUMENTS;
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-13 16:17:10 +00:00
|
|
|
|
/** Cтолбeц значений типа массив.
|
|
|
|
|
* В памяти он представлен, как один столбец вложенного типа, размер которого равен сумме размеров всех массивов,
|
|
|
|
|
* и как массив смещений в нём, который позволяет достать каждый элемент.
|
|
|
|
|
*/
|
2014-06-04 01:00:09 +00:00
|
|
|
|
class ColumnArray final : public IColumn
|
2010-05-13 16:17:10 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/** По индексу i находится смещение до начала i + 1 -го элемента. */
|
2016-05-28 10:35:44 +00:00
|
|
|
|
using ColumnOffsets_t = ColumnVector<Offset_t>;
|
2010-05-13 16:17:10 +00:00
|
|
|
|
|
|
|
|
|
/** Создать пустой столбец массивов, с типом значений, как в столбце nested_column */
|
2014-04-08 07:31:51 +00:00
|
|
|
|
explicit ColumnArray(ColumnPtr nested_column, ColumnPtr offsets_column = nullptr)
|
2013-05-20 15:42:57 +00:00
|
|
|
|
: data(nested_column), offsets(offsets_column)
|
2010-05-13 16:17:10 +00:00
|
|
|
|
{
|
2013-05-20 15:42:57 +00:00
|
|
|
|
if (!offsets_column)
|
|
|
|
|
{
|
2016-05-28 05:31:36 +00:00
|
|
|
|
offsets = std::make_shared<ColumnOffsets_t>();
|
2013-05-20 15:42:57 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-06-26 00:58:14 +00:00
|
|
|
|
if (!typeid_cast<ColumnOffsets_t *>(&*offsets_column))
|
2016-05-28 05:31:36 +00:00
|
|
|
|
throw Exception("offsets_column must be a ColumnUInt64", ErrorCodes::ILLEGAL_COLUMN);
|
2013-05-20 15:42:57 +00:00
|
|
|
|
}
|
2010-05-13 16:17:10 +00:00
|
|
|
|
}
|
2010-05-21 19:52:50 +00:00
|
|
|
|
|
2016-05-27 01:31:47 +00:00
|
|
|
|
std::string getName() const override { return "ColumnArray(" + getData().getName() + ")"; }
|
2011-08-28 00:31:30 +00:00
|
|
|
|
|
2014-10-31 22:15:17 +00:00
|
|
|
|
ColumnPtr cloneEmpty() const override
|
2010-05-21 19:52:50 +00:00
|
|
|
|
{
|
2016-05-28 05:31:36 +00:00
|
|
|
|
return std::make_shared<ColumnArray>(getData().cloneEmpty());
|
2010-05-21 19:52:50 +00:00
|
|
|
|
}
|
2014-06-26 00:58:14 +00:00
|
|
|
|
|
2014-10-31 22:15:17 +00:00
|
|
|
|
size_t size() const override
|
2010-05-13 16:17:10 +00:00
|
|
|
|
{
|
2012-08-26 04:40:29 +00:00
|
|
|
|
return getOffsets().size();
|
2010-05-13 16:17:10 +00:00
|
|
|
|
}
|
2014-06-26 00:58:14 +00:00
|
|
|
|
|
2014-10-31 22:15:17 +00:00
|
|
|
|
Field operator[](size_t n) const override
|
2010-05-13 16:17:10 +00:00
|
|
|
|
{
|
2011-08-22 20:24:45 +00:00
|
|
|
|
size_t offset = offsetAt(n);
|
|
|
|
|
size_t size = sizeAt(n);
|
2010-05-13 16:17:10 +00:00
|
|
|
|
Array res(size);
|
2014-06-26 00:58:14 +00:00
|
|
|
|
|
2010-05-13 16:17:10 +00:00
|
|
|
|
for (size_t i = 0; i < size; ++i)
|
2016-05-27 01:31:47 +00:00
|
|
|
|
res[i] = getData()[offset + i];
|
2014-06-26 00:58:14 +00:00
|
|
|
|
|
2010-05-13 16:17:10 +00:00
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-31 22:15:17 +00:00
|
|
|
|
void get(size_t n, Field & res) const override
|
2013-01-07 06:47:15 +00:00
|
|
|
|
{
|
|
|
|
|
size_t offset = offsetAt(n);
|
|
|
|
|
size_t size = sizeAt(n);
|
|
|
|
|
res = Array(size);
|
|
|
|
|
Array & res_arr = DB::get<Array &>(res);
|
2014-06-26 00:58:14 +00:00
|
|
|
|
|
2013-01-07 06:47:15 +00:00
|
|
|
|
for (size_t i = 0; i < size; ++i)
|
2016-05-27 01:31:47 +00:00
|
|
|
|
getData().get(offset + i, res_arr[i]);
|
2013-01-07 06:47:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-10-31 22:15:17 +00:00
|
|
|
|
StringRef getDataAt(size_t n) const override
|
2012-10-07 06:30:10 +00:00
|
|
|
|
{
|
2014-11-28 02:17:29 +00:00
|
|
|
|
/** Возвращает диапазон памяти, покрывающий все элементы массива.
|
|
|
|
|
* Работает для массивов значений фиксированной длины.
|
|
|
|
|
* Для массивов строк и массивов массивов полученный кусок памяти может не взаимно-однозначно соответствовать элементам,
|
|
|
|
|
* так как содержит лишь уложенные подряд данные, но не смещения.
|
2014-01-08 19:05:50 +00:00
|
|
|
|
*/
|
2014-11-27 21:31:13 +00:00
|
|
|
|
|
2014-11-28 02:17:29 +00:00
|
|
|
|
size_t array_size = sizeAt(n);
|
|
|
|
|
if (array_size == 0)
|
2014-11-27 21:31:13 +00:00
|
|
|
|
return StringRef();
|
|
|
|
|
|
2014-11-28 02:17:29 +00:00
|
|
|
|
size_t offset_of_first_elem = offsetAt(n);
|
2016-05-27 01:31:47 +00:00
|
|
|
|
StringRef first = getData().getDataAtWithTerminatingZero(offset_of_first_elem);
|
2014-11-27 21:31:13 +00:00
|
|
|
|
|
2014-11-28 02:17:29 +00:00
|
|
|
|
size_t offset_of_last_elem = getOffsets()[n] - 1;
|
2016-05-27 01:31:47 +00:00
|
|
|
|
StringRef last = getData().getDataAtWithTerminatingZero(offset_of_last_elem);
|
2014-11-27 21:31:13 +00:00
|
|
|
|
|
2014-11-28 02:17:29 +00:00
|
|
|
|
return StringRef(first.data, last.data + last.size - first.data);
|
2012-10-07 06:30:10 +00:00
|
|
|
|
}
|
2013-02-16 20:15:45 +00:00
|
|
|
|
|
2014-10-31 22:15:17 +00:00
|
|
|
|
void insertData(const char * pos, size_t length) override
|
2013-02-16 20:15:45 +00:00
|
|
|
|
{
|
2014-03-20 23:11:26 +00:00
|
|
|
|
/** Аналогично - только для массивов значений фиксированной длины.
|
|
|
|
|
*/
|
|
|
|
|
IColumn * data_ = data.get();
|
|
|
|
|
if (!data_->isFixed())
|
|
|
|
|
throw Exception("Method insertData is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED);
|
|
|
|
|
|
|
|
|
|
size_t field_size = data_->sizeOfField();
|
|
|
|
|
|
|
|
|
|
const char * end = pos + length;
|
2014-10-31 22:15:17 +00:00
|
|
|
|
size_t elems = 0;
|
|
|
|
|
for (; pos + field_size <= end; pos += field_size, ++elems)
|
2014-03-20 23:11:26 +00:00
|
|
|
|
data_->insertData(pos, field_size);
|
|
|
|
|
|
|
|
|
|
if (pos != end)
|
|
|
|
|
throw Exception("Incorrect length argument for method ColumnArray::insertData", ErrorCodes::BAD_ARGUMENTS);
|
2014-10-31 22:15:17 +00:00
|
|
|
|
|
|
|
|
|
getOffsets().push_back((getOffsets().size() == 0 ? 0 : getOffsets().back()) + elems);
|
2013-02-16 20:15:45 +00:00
|
|
|
|
}
|
2012-10-07 06:30:10 +00:00
|
|
|
|
|
2015-10-04 03:17:36 +00:00
|
|
|
|
StringRef serializeValueIntoArena(size_t n, Arena & arena, char const *& begin) const override
|
|
|
|
|
{
|
|
|
|
|
size_t array_size = sizeAt(n);
|
|
|
|
|
size_t offset = offsetAt(n);
|
|
|
|
|
|
|
|
|
|
char * pos = arena.allocContinue(sizeof(array_size), begin);
|
|
|
|
|
memcpy(pos, &array_size, sizeof(array_size));
|
|
|
|
|
|
|
|
|
|
size_t values_size = 0;
|
|
|
|
|
for (size_t i = 0; i < array_size; ++i)
|
2016-05-27 01:31:47 +00:00
|
|
|
|
values_size += getData().serializeValueIntoArena(offset + i, arena, begin).size;
|
2015-10-04 03:17:36 +00:00
|
|
|
|
|
|
|
|
|
return StringRef(begin, sizeof(array_size) + values_size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char * deserializeAndInsertFromArena(const char * pos) override
|
|
|
|
|
{
|
|
|
|
|
size_t array_size = *reinterpret_cast<const size_t *>(pos);
|
|
|
|
|
pos += sizeof(array_size);
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < array_size; ++i)
|
2016-05-27 01:31:47 +00:00
|
|
|
|
pos = getData().deserializeAndInsertFromArena(pos);
|
2015-10-04 03:17:36 +00:00
|
|
|
|
|
|
|
|
|
getOffsets().push_back((getOffsets().size() == 0 ? 0 : getOffsets().back()) + array_size);
|
|
|
|
|
return pos;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-10 15:58:58 +00:00
|
|
|
|
void updateHashWithValue(size_t n, SipHash & hash) const override
|
|
|
|
|
{
|
|
|
|
|
size_t array_size = sizeAt(n);
|
|
|
|
|
size_t offset = offsetAt(n);
|
|
|
|
|
|
|
|
|
|
hash.update(reinterpret_cast<const char *>(&array_size), sizeof(array_size));
|
|
|
|
|
for (size_t i = 0; i < array_size; ++i)
|
|
|
|
|
getData().updateHashWithValue(offset + i, hash);
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-29 17:06:30 +00:00
|
|
|
|
void insertRangeFrom(const IColumn & src, size_t start, size_t length) override;
|
2010-05-13 16:17:10 +00:00
|
|
|
|
|
2014-10-31 22:15:17 +00:00
|
|
|
|
void insert(const Field & x) override
|
2010-05-20 19:29:04 +00:00
|
|
|
|
{
|
2013-01-07 06:47:15 +00:00
|
|
|
|
const Array & array = DB::get<const Array &>(x);
|
2010-05-20 19:29:04 +00:00
|
|
|
|
size_t size = array.size();
|
|
|
|
|
for (size_t i = 0; i < size; ++i)
|
2016-05-27 01:31:47 +00:00
|
|
|
|
getData().insert(array[i]);
|
2012-08-26 04:40:29 +00:00
|
|
|
|
getOffsets().push_back((getOffsets().size() == 0 ? 0 : getOffsets().back()) + size);
|
2010-05-20 19:29:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-10-31 22:15:17 +00:00
|
|
|
|
void insertFrom(const IColumn & src_, size_t n) override
|
2012-12-16 00:52:06 +00:00
|
|
|
|
{
|
|
|
|
|
const ColumnArray & src = static_cast<const ColumnArray &>(src_);
|
|
|
|
|
size_t size = src.sizeAt(n);
|
|
|
|
|
size_t offset = src.offsetAt(n);
|
|
|
|
|
|
2016-05-27 01:31:47 +00:00
|
|
|
|
getData().insertRangeFrom(src.getData(), offset, size);
|
2012-12-16 00:52:06 +00:00
|
|
|
|
getOffsets().push_back((getOffsets().size() == 0 ? 0 : getOffsets().back()) + size);
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-31 22:15:17 +00:00
|
|
|
|
void insertDefault() override
|
2010-05-20 19:29:04 +00:00
|
|
|
|
{
|
2014-08-18 07:18:40 +00:00
|
|
|
|
getOffsets().push_back(getOffsets().size() == 0 ? 0 : getOffsets().back());
|
2010-05-20 19:29:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-16 16:39:39 +00:00
|
|
|
|
void popBack(size_t n) override
|
|
|
|
|
{
|
|
|
|
|
auto & offsets = getOffsets();
|
|
|
|
|
size_t nested_n = offsets.back() - offsetAt(offsets.size() - n);
|
2016-06-28 20:45:28 +00:00
|
|
|
|
if (nested_n)
|
|
|
|
|
getData().popBack(nested_n);
|
2016-02-16 16:39:39 +00:00
|
|
|
|
offsets.resize_assume_reserved(offsets.size() - n);
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-05 07:01:18 +00:00
|
|
|
|
ColumnPtr filter(const Filter & filt, ssize_t result_size_hint) const override;
|
2011-09-04 00:22:19 +00:00
|
|
|
|
|
2015-07-06 19:24:51 +00:00
|
|
|
|
ColumnPtr permute(const Permutation & perm, size_t limit) const override;
|
2011-09-04 00:22:19 +00:00
|
|
|
|
|
2014-10-31 22:15:17 +00:00
|
|
|
|
int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const override
|
2011-09-04 00:22:19 +00:00
|
|
|
|
{
|
|
|
|
|
const ColumnArray & rhs = static_cast<const ColumnArray &>(rhs_);
|
|
|
|
|
|
|
|
|
|
/// Не оптимально
|
|
|
|
|
size_t lhs_size = sizeAt(n);
|
|
|
|
|
size_t rhs_size = rhs.sizeAt(m);
|
|
|
|
|
size_t min_size = std::min(lhs_size, rhs_size);
|
|
|
|
|
for (size_t i = 0; i < min_size; ++i)
|
2016-05-27 01:31:47 +00:00
|
|
|
|
if (int res = getData().compareAt(offsetAt(n) + i, rhs.offsetAt(m) + i, *rhs.data.get(), nan_direction_hint))
|
2011-09-04 00:22:19 +00:00
|
|
|
|
return res;
|
|
|
|
|
|
|
|
|
|
return lhs_size < rhs_size
|
|
|
|
|
? -1
|
|
|
|
|
: (lhs_size == rhs_size
|
|
|
|
|
? 0
|
|
|
|
|
: 1);
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-16 05:44:47 +00:00
|
|
|
|
template <bool positive>
|
2011-09-26 11:05:38 +00:00
|
|
|
|
struct less
|
|
|
|
|
{
|
|
|
|
|
const ColumnArray & parent;
|
|
|
|
|
|
2014-03-25 23:16:20 +00:00
|
|
|
|
less(const ColumnArray & parent_) : parent(parent_) {}
|
|
|
|
|
|
2011-09-26 11:05:38 +00:00
|
|
|
|
bool operator()(size_t lhs, size_t rhs) const
|
|
|
|
|
{
|
2014-03-25 23:16:20 +00:00
|
|
|
|
if (positive)
|
|
|
|
|
return parent.compareAt(lhs, rhs, parent, 1) < 0;
|
|
|
|
|
else
|
|
|
|
|
return parent.compareAt(lhs, rhs, parent, -1) > 0;
|
2011-09-26 11:05:38 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2015-07-06 19:24:51 +00:00
|
|
|
|
void getPermutation(bool reverse, size_t limit, Permutation & res) const override;
|
2011-09-26 11:05:38 +00:00
|
|
|
|
|
2014-10-31 22:15:17 +00:00
|
|
|
|
void reserve(size_t n) override
|
2013-02-03 18:39:09 +00:00
|
|
|
|
{
|
|
|
|
|
getOffsets().reserve(n);
|
|
|
|
|
getData().reserve(n); /// Средний размер массивов тут никак не учитывается. Или считается, что он не больше единицы.
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-31 22:15:17 +00:00
|
|
|
|
size_t byteSize() const override
|
2011-08-27 22:43:31 +00:00
|
|
|
|
{
|
2016-05-27 01:31:47 +00:00
|
|
|
|
return getData().byteSize() + getOffsets().size() * sizeof(getOffsets()[0]);
|
2011-08-27 22:43:31 +00:00
|
|
|
|
}
|
2013-09-06 20:28:22 +00:00
|
|
|
|
|
2013-07-22 16:49:19 +00:00
|
|
|
|
bool hasEqualOffsets(const ColumnArray & other) const
|
2013-07-22 12:04:08 +00:00
|
|
|
|
{
|
2013-07-22 16:49:19 +00:00
|
|
|
|
if (offsets == other.offsets)
|
2013-07-22 12:04:08 +00:00
|
|
|
|
return true;
|
2014-06-26 00:58:14 +00:00
|
|
|
|
|
2013-07-22 12:04:08 +00:00
|
|
|
|
const Offsets_t & offsets1 = getOffsets();
|
2013-07-22 16:49:19 +00:00
|
|
|
|
const Offsets_t & offsets2 = other.getOffsets();
|
2013-07-22 12:04:08 +00:00
|
|
|
|
return offsets1.size() == offsets2.size() && 0 == memcmp(&offsets1[0], &offsets2[0], sizeof(offsets1[0]) * offsets1.size());
|
|
|
|
|
}
|
2011-08-27 22:43:31 +00:00
|
|
|
|
|
2010-05-13 16:17:10 +00:00
|
|
|
|
/** Более эффективные методы манипуляции */
|
2016-05-27 01:31:47 +00:00
|
|
|
|
IColumn & getData() { return *data.get(); }
|
|
|
|
|
const IColumn & getData() const { return *data.get(); }
|
2010-05-13 16:17:10 +00:00
|
|
|
|
|
2012-08-26 11:14:52 +00:00
|
|
|
|
ColumnPtr & getDataPtr() { return data; }
|
|
|
|
|
const ColumnPtr & getDataPtr() const { return data; }
|
2010-05-13 16:17:10 +00:00
|
|
|
|
|
2014-10-06 22:48:20 +00:00
|
|
|
|
Offsets_t & ALWAYS_INLINE getOffsets()
|
2010-05-13 16:17:10 +00:00
|
|
|
|
{
|
2012-08-26 04:40:29 +00:00
|
|
|
|
return static_cast<ColumnOffsets_t &>(*offsets.get()).getData();
|
2010-05-13 16:17:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-10-06 22:48:20 +00:00
|
|
|
|
const Offsets_t & ALWAYS_INLINE getOffsets() const
|
2010-05-13 16:17:10 +00:00
|
|
|
|
{
|
2012-08-26 04:40:29 +00:00
|
|
|
|
return static_cast<const ColumnOffsets_t &>(*offsets.get()).getData();
|
2010-05-13 16:17:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-26 06:48:39 +00:00
|
|
|
|
ColumnPtr & getOffsetsColumn() { return offsets; }
|
|
|
|
|
const ColumnPtr & getOffsetsColumn() const { return offsets; }
|
|
|
|
|
|
2013-07-27 21:50:13 +00:00
|
|
|
|
|
2015-07-06 19:24:51 +00:00
|
|
|
|
ColumnPtr replicate(const Offsets_t & replicate_offsets) const override;
|
2013-07-27 21:50:13 +00:00
|
|
|
|
|
2015-10-28 21:21:18 +00:00
|
|
|
|
|
|
|
|
|
ColumnPtr convertToFullColumnIfConst() const override
|
|
|
|
|
{
|
|
|
|
|
ColumnPtr new_data;
|
|
|
|
|
ColumnPtr new_offsets;
|
|
|
|
|
|
2016-05-27 01:31:47 +00:00
|
|
|
|
if (auto full_column = getData().convertToFullColumnIfConst())
|
2015-10-28 21:21:18 +00:00
|
|
|
|
new_data = full_column;
|
|
|
|
|
else
|
|
|
|
|
new_data = data;
|
|
|
|
|
|
2016-04-15 03:05:18 +00:00
|
|
|
|
if (auto full_column = offsets.get()->convertToFullColumnIfConst())
|
2015-10-28 21:21:18 +00:00
|
|
|
|
new_offsets = full_column;
|
|
|
|
|
else
|
|
|
|
|
new_offsets = offsets;
|
|
|
|
|
|
2016-05-28 05:31:36 +00:00
|
|
|
|
return std::make_shared<ColumnArray>(new_data, new_offsets);
|
2015-10-28 21:21:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-08-10 19:12:29 +00:00
|
|
|
|
void getExtremes(Field & min, Field & max) const override
|
2016-07-05 16:23:37 +00:00
|
|
|
|
{
|
|
|
|
|
min = Array();
|
|
|
|
|
max = Array();
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-10 19:12:29 +00:00
|
|
|
|
private:
|
2011-08-09 19:19:00 +00:00
|
|
|
|
ColumnPtr data;
|
2012-08-26 06:48:39 +00:00
|
|
|
|
ColumnPtr offsets; /// Смещения могут быть разделяемыми для нескольких столбцов - для реализации вложенных структур данных.
|
2011-08-22 20:24:45 +00:00
|
|
|
|
|
2014-10-06 22:48:20 +00:00
|
|
|
|
size_t ALWAYS_INLINE offsetAt(size_t i) const { return i == 0 ? 0 : getOffsets()[i - 1]; }
|
2014-11-27 21:31:13 +00:00
|
|
|
|
size_t ALWAYS_INLINE sizeAt(size_t i) const { return i == 0 ? getOffsets()[0] : (getOffsets()[i] - getOffsets()[i - 1]); }
|
2013-07-27 21:50:13 +00:00
|
|
|
|
|
|
|
|
|
|
2015-11-21 03:19:43 +00:00
|
|
|
|
/// Размножить значения, если вложенный столбец - ColumnVector<T>.
|
2013-07-27 21:50:13 +00:00
|
|
|
|
template <typename T>
|
2015-11-21 03:19:43 +00:00
|
|
|
|
ColumnPtr replicateNumber(const Offsets_t & replicate_offsets) const;
|
2013-07-28 00:35:29 +00:00
|
|
|
|
|
|
|
|
|
/// Размножить значения, если вложенный столбец - ColumnString. Код слишком сложный.
|
2015-07-06 19:24:51 +00:00
|
|
|
|
ColumnPtr replicateString(const Offsets_t & replicate_offsets) const;
|
|
|
|
|
|
|
|
|
|
/** Неконстантные массивы константных значений - довольно редкое явление.
|
|
|
|
|
* Большинство функций не умеет с ними работать, и не создаёт такие столбцы в качестве результата.
|
|
|
|
|
* Исключение - функция replicate (см. FunctionsMiscellaneous.h), которая имеет служебное значение для реализации лямбда-функций.
|
|
|
|
|
* Только ради неё сделана реализация метода replicate для ColumnArray(ColumnConst).
|
|
|
|
|
*/
|
|
|
|
|
ColumnPtr replicateConst(const Offsets_t & replicate_offsets) const;
|
2015-11-21 03:19:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Специализации для функции filter.
|
|
|
|
|
template <typename T>
|
2015-12-05 07:01:18 +00:00
|
|
|
|
ColumnPtr filterNumber(const Filter & filt, ssize_t result_size_hint) const;
|
2015-11-21 03:19:43 +00:00
|
|
|
|
|
2015-12-05 07:01:18 +00:00
|
|
|
|
ColumnPtr filterString(const Filter & filt, ssize_t result_size_hint) const;
|
|
|
|
|
ColumnPtr filterGeneric(const Filter & filt, ssize_t result_size_hint) const;
|
2010-05-13 16:17:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|