mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Separated ColumnString from ColumnArray and ColumnFixedString from ColumnFixedArray; removed ColumnFixedArray [#CONV-2944].
This commit is contained in:
parent
15b0ef253c
commit
28c9579a5f
@ -292,7 +292,7 @@ public:
|
||||
ColumnPtr & getOffsetsColumn() { return offsets; }
|
||||
const ColumnPtr & getOffsetsColumn() const { return offsets; }
|
||||
|
||||
protected:
|
||||
private:
|
||||
ColumnPtr data;
|
||||
ColumnPtr offsets; /// Смещения могут быть разделяемыми для нескольких столбцов - для реализации вложенных структур данных.
|
||||
|
||||
|
@ -1,225 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Poco/SharedPtr.h>
|
||||
|
||||
#include <DB/Core/Exception.h>
|
||||
#include <DB/Core/ErrorCodes.h>
|
||||
|
||||
#include <DB/Columns/IColumn.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
using Poco::SharedPtr;
|
||||
|
||||
/** Cтолбeц значений типа "массив фиксированного размера".
|
||||
*
|
||||
* TODO: Удалить, так как не нужно.
|
||||
*/
|
||||
class ColumnFixedArray : public IColumn
|
||||
{
|
||||
public:
|
||||
/** Создать пустой столбец массивов фиксированного размера n, с типом значений, как в столбце nested_column */
|
||||
ColumnFixedArray(ColumnPtr nested_column, size_t n_)
|
||||
: data(nested_column->cloneEmpty()), n(n_)
|
||||
{
|
||||
}
|
||||
|
||||
std::string getName() const { return "ColumnFixedArray(" + data->getName() + ")"; }
|
||||
|
||||
ColumnPtr cloneEmpty() const
|
||||
{
|
||||
return new ColumnFixedArray(data->cloneEmpty(), n);
|
||||
}
|
||||
|
||||
size_t size() const
|
||||
{
|
||||
return data->size() / n;
|
||||
}
|
||||
|
||||
Field operator[](size_t index) const
|
||||
{
|
||||
Array res;
|
||||
for (size_t i = n * index; i < n * (index + 1); ++i)
|
||||
res[i] = (*data)[n * index + i];
|
||||
return res;
|
||||
}
|
||||
|
||||
void get(size_t index, Field & res) const
|
||||
{
|
||||
res = Array(n);
|
||||
Array & res_arr = DB::get<Array &>(res);
|
||||
for (size_t i = n * index; i < n * (index + 1); ++i)
|
||||
data->get(n * index + i, res_arr[i]);
|
||||
}
|
||||
|
||||
StringRef getDataAt(size_t n) const
|
||||
{
|
||||
throw Exception("Method getDataAt is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
void insertData(const char * pos, size_t length)
|
||||
{
|
||||
throw Exception("Method insertData is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
ColumnPtr cut(size_t start, size_t length) const
|
||||
{
|
||||
ColumnFixedArray * res_ = new ColumnFixedArray(data, n);
|
||||
ColumnPtr res = res_;
|
||||
res_->data = data->cut(n * start, n * length);
|
||||
return res;
|
||||
}
|
||||
|
||||
void insert(const Field & x)
|
||||
{
|
||||
const Array & array = DB::get<const Array &>(x);
|
||||
if (n != array.size())
|
||||
throw Exception("Size of array doesn't match size of FixedArray column",
|
||||
ErrorCodes::SIZE_OF_ARRAY_DOESNT_MATCH_SIZE_OF_FIXEDARRAY_COLUMN);
|
||||
|
||||
for (size_t i = 0; i < n; ++i)
|
||||
data->insert(array[i]);
|
||||
}
|
||||
|
||||
void insertFrom(const IColumn & src_, size_t index)
|
||||
{
|
||||
const ColumnFixedArray & src = static_cast<const ColumnFixedArray &>(src_);
|
||||
|
||||
if (n != src.getN())
|
||||
throw Exception("Size of array doesn't match size of FixedArray column",
|
||||
ErrorCodes::SIZE_OF_ARRAY_DOESNT_MATCH_SIZE_OF_FIXEDARRAY_COLUMN);
|
||||
|
||||
for (size_t i = 0; i < n; ++i)
|
||||
data->insertFrom(src.getData(), n * index + i);
|
||||
}
|
||||
|
||||
void insertDefault()
|
||||
{
|
||||
for (size_t i = 0; i < n; ++i)
|
||||
data->insertDefault();
|
||||
}
|
||||
|
||||
/** Более эффективные методы манипуляции */
|
||||
IColumn & getData()
|
||||
{
|
||||
return *data;
|
||||
}
|
||||
|
||||
ColumnPtr filter(const Filter & filt) const
|
||||
{
|
||||
size_t size = this->size();
|
||||
if (size != filt.size())
|
||||
throw Exception("Size of filter doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
|
||||
|
||||
if (size == 0)
|
||||
return new ColumnFixedArray(data, n);
|
||||
|
||||
/// Не слишком оптимально. Можно сделать специализацию для массивов известных типов.
|
||||
Filter nested_filt(size * n);
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
if (filt[i])
|
||||
memset(&nested_filt[i * n], 1, n);
|
||||
|
||||
ColumnFixedArray * res_ = new ColumnFixedArray(data, n);
|
||||
ColumnPtr res = res_;
|
||||
res_->data = data->filter(nested_filt);
|
||||
return res;
|
||||
}
|
||||
|
||||
ColumnPtr replicate(const Offsets_t & offsets) const
|
||||
{
|
||||
throw Exception("Replication of column FixedArray is not implemented.", ErrorCodes::NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
ColumnPtr permute(const Permutation & perm) const
|
||||
{
|
||||
size_t size = this->size();
|
||||
if (size != perm.size())
|
||||
throw Exception("Size of permutation doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
|
||||
|
||||
if (size == 0)
|
||||
return new ColumnFixedArray(data, n);
|
||||
|
||||
Permutation nested_perm(size * n);
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
for (size_t j = 0; j < n; ++j)
|
||||
nested_perm[i * n + j] = perm[i] * n + j;
|
||||
|
||||
ColumnFixedArray * res_ = new ColumnFixedArray(data, n);
|
||||
ColumnPtr res = res_;
|
||||
res_->data = data->permute(nested_perm);
|
||||
return res;
|
||||
}
|
||||
|
||||
int compareAt(size_t p1, size_t p2, const IColumn & rhs_) const
|
||||
{
|
||||
const ColumnFixedArray & rhs = static_cast<const ColumnFixedArray &>(rhs_);
|
||||
|
||||
/// Не оптимально
|
||||
for (size_t i = 0; i < n; ++i)
|
||||
if (int res = data->compareAt(p1 * n + i, p2 * n + i, *rhs.data))
|
||||
return res;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct less
|
||||
{
|
||||
const ColumnFixedArray & parent;
|
||||
const Permutation & nested_perm;
|
||||
|
||||
less(const ColumnFixedArray & parent_, const Permutation & nested_perm_) : parent(parent_), nested_perm(nested_perm_) {}
|
||||
bool operator()(size_t lhs, size_t rhs) const
|
||||
{
|
||||
for (size_t i = 0; i < parent.n; ++i)
|
||||
{
|
||||
if (nested_perm[lhs * parent.n + i] < nested_perm[rhs * parent.n + i])
|
||||
return true;
|
||||
else if (nested_perm[lhs * parent.n + i] > nested_perm[rhs * parent.n + i])
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
Permutation getPermutation() const
|
||||
{
|
||||
Permutation nested_perm = data->getPermutation();
|
||||
size_t s = data->size() / n;
|
||||
Permutation res(s);
|
||||
for (size_t i = 0; i < s; ++i)
|
||||
res[i] = i;
|
||||
|
||||
std::sort(res.begin(), res.end(), less(*this, nested_perm));
|
||||
return res;
|
||||
}
|
||||
|
||||
void reserve(size_t elems)
|
||||
{
|
||||
data->reserve(n * elems);
|
||||
}
|
||||
|
||||
size_t byteSize() const
|
||||
{
|
||||
return data->byteSize() + sizeof(n);
|
||||
}
|
||||
|
||||
const IColumn & getData() const
|
||||
{
|
||||
return *data;
|
||||
}
|
||||
|
||||
size_t getN() const
|
||||
{
|
||||
return n;
|
||||
}
|
||||
|
||||
protected:
|
||||
ColumnPtr data;
|
||||
const size_t n;
|
||||
};
|
||||
|
||||
|
||||
}
|
@ -2,29 +2,29 @@
|
||||
|
||||
#include <string.h> // memcpy
|
||||
|
||||
#include <DB/Columns/ColumnFixedArray.h>
|
||||
#include <DB/Columns/ColumnsNumber.h>
|
||||
#include <DB/Columns/IColumn.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
/** Cтолбeц значений типа "строка фиксированной длины".
|
||||
* Отличается от массива UInt8 фиксированной длины только получением элемента (в виде String, а не Array)
|
||||
* Если вставить строку меньшей длины, то она будет дополнена нулевыми байтами.
|
||||
*/
|
||||
class ColumnFixedString : public ColumnFixedArray
|
||||
class ColumnFixedString : public IColumn
|
||||
{
|
||||
public:
|
||||
typedef std::vector<UInt8> Chars_t;
|
||||
|
||||
private:
|
||||
ColumnUInt8::Container_t & char_data;
|
||||
/// Размер строк.
|
||||
const size_t n;
|
||||
/// Байты строк, уложенные подряд. Строки хранятся без завершающего нулевого байта.
|
||||
Chars_t chars;
|
||||
|
||||
public:
|
||||
/** Создать пустой столбец строк фиксированной длины n */
|
||||
ColumnFixedString(size_t n)
|
||||
: ColumnFixedArray(new ColumnUInt8(), n),
|
||||
char_data(static_cast<ColumnUInt8 &>(*data).getData())
|
||||
{
|
||||
}
|
||||
ColumnFixedString(size_t n_) : n(n_) {}
|
||||
|
||||
std::string getName() const { return "ColumnFixedString"; }
|
||||
|
||||
@ -32,20 +32,30 @@ public:
|
||||
{
|
||||
return new ColumnFixedString(n);
|
||||
}
|
||||
|
||||
size_t size() const
|
||||
{
|
||||
return chars.size() / n;
|
||||
}
|
||||
|
||||
size_t byteSize() const
|
||||
{
|
||||
return chars.size() + sizeof(n);
|
||||
}
|
||||
|
||||
Field operator[](size_t index) const
|
||||
{
|
||||
return String(reinterpret_cast<const char *>(&char_data[n * index]), n);
|
||||
return String(reinterpret_cast<const char *>(&chars[n * index]), n);
|
||||
}
|
||||
|
||||
void get(size_t index, Field & res) const
|
||||
{
|
||||
res.assignString(reinterpret_cast<const char *>(&char_data[n * index]), n);
|
||||
res.assignString(reinterpret_cast<const char *>(&chars[n * index]), n);
|
||||
}
|
||||
|
||||
StringRef getDataAt(size_t index) const
|
||||
{
|
||||
return StringRef(&char_data[n * index], n);
|
||||
return StringRef(&chars[n * index], n);
|
||||
}
|
||||
|
||||
void insert(const Field & x)
|
||||
@ -55,9 +65,9 @@ public:
|
||||
if (s.size() > n)
|
||||
throw Exception("Too large string '" + s + "' for FixedString column", ErrorCodes::TOO_LARGE_STRING_SIZE);
|
||||
|
||||
size_t old_size = char_data.size();
|
||||
char_data.resize(old_size + n);
|
||||
memcpy(&char_data[old_size], s.data(), s.size());
|
||||
size_t old_size = chars.size();
|
||||
chars.resize(old_size + n);
|
||||
memcpy(&chars[old_size], s.data(), s.size());
|
||||
}
|
||||
|
||||
void insertFrom(const IColumn & src_, size_t index)
|
||||
@ -67,27 +77,27 @@ public:
|
||||
if (n != src.getN())
|
||||
throw Exception("Size of FixedString doesn't match", ErrorCodes::SIZE_OF_ARRAY_DOESNT_MATCH_SIZE_OF_FIXEDARRAY_COLUMN);
|
||||
|
||||
size_t old_size = char_data.size();
|
||||
char_data.resize(old_size + n);
|
||||
memcpy(&char_data[old_size], &src.char_data[n * index], n);
|
||||
size_t old_size = chars.size();
|
||||
chars.resize(old_size + n);
|
||||
memcpy(&chars[old_size], &src.chars[n * index], n);
|
||||
}
|
||||
|
||||
void insertData(const char * pos, size_t length)
|
||||
{
|
||||
size_t old_size = char_data.size();
|
||||
char_data.resize(old_size + n);
|
||||
memcpy(&char_data[old_size], pos, n);
|
||||
size_t old_size = chars.size();
|
||||
chars.resize(old_size + n);
|
||||
memcpy(&chars[old_size], pos, n);
|
||||
}
|
||||
|
||||
void insertDefault()
|
||||
{
|
||||
char_data.resize(char_data.size() + n);
|
||||
chars.resize(chars.size() + n);
|
||||
}
|
||||
|
||||
int compareAt(size_t p1, size_t p2, const IColumn & rhs_) const
|
||||
{
|
||||
const ColumnFixedString & rhs = static_cast<const ColumnFixedString &>(rhs_);
|
||||
return memcmp(&char_data[p1 * n], &rhs.char_data[p2 * n], n);
|
||||
return memcmp(&chars[p1 * n], &rhs.chars[p2 * n], n);
|
||||
}
|
||||
|
||||
struct less
|
||||
@ -96,7 +106,7 @@ public:
|
||||
less(const ColumnFixedString & parent_) : parent(parent_) {}
|
||||
bool operator()(size_t lhs, size_t rhs) const
|
||||
{
|
||||
return 0 > memcmp(&parent.char_data[lhs * parent.n], &parent.char_data[rhs * parent.n], parent.n);
|
||||
return 0 > memcmp(&parent.chars[lhs * parent.n], &parent.chars[rhs * parent.n], parent.n);
|
||||
}
|
||||
};
|
||||
|
||||
@ -115,48 +125,54 @@ public:
|
||||
{
|
||||
ColumnFixedString * res_ = new ColumnFixedString(n);
|
||||
ColumnPtr res = res_;
|
||||
res_->data = data->cut(n * start, n * length);
|
||||
res_->chars.resize(n * length);
|
||||
memcpy(&res_->chars[0], &chars[n * start], n * length);
|
||||
return res;
|
||||
}
|
||||
|
||||
ColumnPtr filter(const Filter & filt) const
|
||||
ColumnPtr filter(const IColumn::Filter & filt) const
|
||||
{
|
||||
size_t size = this->size();
|
||||
if (size != filt.size())
|
||||
size_t col_size = size();
|
||||
if (col_size != filt.size())
|
||||
throw Exception("Size of filter doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
|
||||
|
||||
if (size == 0)
|
||||
return new ColumnFixedString(n);
|
||||
|
||||
/// Не слишком оптимально. Можно сделать специализацию для массивов известных типов.
|
||||
Filter nested_filt(size * n);
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
if (filt[i])
|
||||
memset(&nested_filt[i * n], 1, n);
|
||||
|
||||
ColumnFixedString * res_ = new ColumnFixedString(n);
|
||||
ColumnPtr res = res_;
|
||||
res_->data = data->filter(nested_filt);
|
||||
res_->chars.reserve(chars.size());
|
||||
|
||||
size_t offset = 0;
|
||||
for (size_t i = 0; i < col_size; ++i, offset += n)
|
||||
{
|
||||
if (filt[i])
|
||||
{
|
||||
res_->chars.resize(res_->chars.size() + n);
|
||||
memcpy(&res_->chars[res_->chars.size() - n], &chars[offset], n);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
ColumnPtr permute(const Permutation & perm) const
|
||||
{
|
||||
size_t size = this->size();
|
||||
if (size != perm.size())
|
||||
size_t col_size = size();
|
||||
if (col_size != perm.size())
|
||||
throw Exception("Size of permutation doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
|
||||
|
||||
if (size == 0)
|
||||
if (col_size == 0)
|
||||
return new ColumnFixedString(n);
|
||||
|
||||
Permutation nested_perm(size * n);
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
for (size_t j = 0; j < n; ++j)
|
||||
nested_perm[i * n + j] = perm[i] * n + j;
|
||||
|
||||
ColumnFixedString * res_ = new ColumnFixedString(n);
|
||||
ColumnPtr res = res_;
|
||||
res_->data = data->permute(nested_perm);
|
||||
|
||||
Chars_t & res_chars = res_->chars;
|
||||
|
||||
res_chars.resize(chars.size());
|
||||
|
||||
size_t offset = 0;
|
||||
for (size_t i = 0; i < col_size; ++i, offset += n)
|
||||
memcpy(&res_chars[offset], &chars[perm[i] * n], n);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -169,7 +185,7 @@ public:
|
||||
ColumnFixedString * res_ = new ColumnFixedString(n);
|
||||
ColumnPtr res = res_;
|
||||
|
||||
ColumnUInt8::Container_t & res_chars = res_->char_data;
|
||||
Chars_t & res_chars = res_->chars;
|
||||
res_chars.reserve(n * offsets.back());
|
||||
|
||||
Offset_t prev_offset = 0;
|
||||
@ -180,11 +196,17 @@ public:
|
||||
|
||||
for (size_t j = 0; j < size_to_replicate; ++j)
|
||||
for (size_t k = 0; k < n; ++k)
|
||||
res_chars.push_back(char_data[i * n + k]);
|
||||
res_chars.push_back(chars[i * n + k]);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Chars_t & getChars() { return chars; }
|
||||
const Chars_t & getChars() const { return chars; }
|
||||
|
||||
size_t getN() const { return n; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -4,105 +4,112 @@
|
||||
|
||||
#include <DB/Core/Defines.h>
|
||||
|
||||
#include <DB/Columns/ColumnArray.h>
|
||||
#include <DB/Columns/ColumnsNumber.h>
|
||||
#include <DB/Columns/IColumn.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
/** Cтолбeц значений типа "строка".
|
||||
* Отличается от массива UInt8 только получением элемента (в виде String, а не Array),
|
||||
* а также тем, что завершающие нули для строк тоже хранятся.
|
||||
*
|
||||
* TODO: Отделить от ColumnArray.
|
||||
*/
|
||||
class ColumnString : public ColumnArray
|
||||
class ColumnString : public IColumn
|
||||
{
|
||||
public:
|
||||
typedef ColumnUInt8::Container_t DataVector_t;
|
||||
typedef std::vector<UInt8> Chars_t;
|
||||
|
||||
private:
|
||||
DataVector_t & char_data;
|
||||
/// По индексу i находится смещение до начала i + 1 -го элемента.
|
||||
Offsets_t offsets;
|
||||
|
||||
/// Байты строк, уложенные подряд. Строки хранятся с завершающим нулевым байтом.
|
||||
Chars_t chars;
|
||||
|
||||
size_t __attribute__((__always_inline__)) offsetAt(size_t i) const { return i == 0 ? 0 : offsets[i - 1]; }
|
||||
|
||||
/// Размер, включая завершающий нулевой байт.
|
||||
size_t __attribute__((__always_inline__)) sizeAt(size_t i) const { return i == 0 ? offsets[0] : (offsets[i] - offsets[i - 1]); }
|
||||
|
||||
public:
|
||||
/** Создать пустой столбец строк */
|
||||
ColumnString()
|
||||
: ColumnArray(new ColumnUInt8()),
|
||||
char_data(static_cast<ColumnUInt8 &>(*data).getData())
|
||||
{
|
||||
}
|
||||
ColumnString() {}
|
||||
|
||||
std::string getName() const { return "ColumnString"; }
|
||||
|
||||
size_t size() const
|
||||
{
|
||||
return offsets.size();
|
||||
}
|
||||
|
||||
size_t byteSize() const
|
||||
{
|
||||
return chars.size() + offsets.size() * sizeof(offsets[0]);
|
||||
}
|
||||
|
||||
ColumnPtr cloneEmpty() const
|
||||
{
|
||||
return new ColumnString;
|
||||
}
|
||||
|
||||
ColumnUInt8::Container_t & getDataVector() { return char_data; }
|
||||
const ColumnUInt8::Container_t & getDataVector() const { return char_data; }
|
||||
|
||||
|
||||
Field operator[](size_t n) const
|
||||
{
|
||||
return Field(&char_data[offsetAt(n)], sizeAt(n) - 1);
|
||||
return Field(&chars[offsetAt(n)], sizeAt(n) - 1);
|
||||
}
|
||||
|
||||
void get(size_t n, Field & res) const
|
||||
{
|
||||
res.assignString(&char_data[offsetAt(n)], sizeAt(n) - 1);
|
||||
res.assignString(&chars[offsetAt(n)], sizeAt(n) - 1);
|
||||
}
|
||||
|
||||
StringRef getDataAt(size_t n) const
|
||||
{
|
||||
return StringRef(&char_data[offsetAt(n)], sizeAt(n) - 1);
|
||||
return StringRef(&chars[offsetAt(n)], sizeAt(n) - 1);
|
||||
}
|
||||
|
||||
StringRef getDataAtWithTerminatingZero(size_t n) const
|
||||
{
|
||||
return StringRef(&char_data[offsetAt(n)], sizeAt(n));
|
||||
return StringRef(&chars[offsetAt(n)], sizeAt(n));
|
||||
}
|
||||
|
||||
void insert(const Field & x)
|
||||
{
|
||||
const String & s = DB::get<const String &>(x);
|
||||
size_t old_size = char_data.size();
|
||||
size_t old_size = chars.size();
|
||||
size_t size_to_append = s.size() + 1;
|
||||
|
||||
char_data.resize(old_size + size_to_append);
|
||||
memcpy(&char_data[old_size], s.c_str(), size_to_append);
|
||||
getOffsets().push_back((getOffsets().size() == 0 ? 0 : getOffsets().back()) + size_to_append);
|
||||
chars.resize(old_size + size_to_append);
|
||||
memcpy(&chars[old_size], s.c_str(), size_to_append);
|
||||
offsets.push_back((offsets.size() == 0 ? 0 : offsets.back()) + size_to_append);
|
||||
}
|
||||
|
||||
void insertFrom(const IColumn & src_, size_t n)
|
||||
{
|
||||
const ColumnString & src = static_cast<const ColumnString &>(src_);
|
||||
size_t old_size = char_data.size();
|
||||
size_t old_size = chars.size();
|
||||
size_t size_to_append = src.sizeAt(n);
|
||||
size_t offset = src.offsetAt(n);
|
||||
|
||||
char_data.resize(old_size + size_to_append);
|
||||
memcpy(&char_data[old_size], &src.char_data[offset], size_to_append);
|
||||
getOffsets().push_back((getOffsets().size() == 0 ? 0 : getOffsets().back()) + size_to_append);
|
||||
chars.resize(old_size + size_to_append);
|
||||
memcpy(&chars[old_size], &src.chars[offset], size_to_append);
|
||||
offsets.push_back((offsets.size() == 0 ? 0 : offsets.back()) + size_to_append);
|
||||
}
|
||||
|
||||
void insertData(const char * pos, size_t length)
|
||||
{
|
||||
size_t old_size = char_data.size();
|
||||
size_t old_size = chars.size();
|
||||
|
||||
char_data.resize(old_size + length + 1);
|
||||
memcpy(&char_data[old_size], pos, length);
|
||||
char_data[old_size + length] = 0;
|
||||
getOffsets().push_back((getOffsets().size() == 0 ? 0 : getOffsets().back()) + length + 1);
|
||||
chars.resize(old_size + length + 1);
|
||||
memcpy(&chars[old_size], pos, length);
|
||||
chars[old_size + length] = 0;
|
||||
offsets.push_back((offsets.size() == 0 ? 0 : offsets.back()) + length + 1);
|
||||
}
|
||||
|
||||
void insertDataWithTerminatingZero(const char * pos, size_t length)
|
||||
{
|
||||
size_t old_size = char_data.size();
|
||||
size_t old_size = chars.size();
|
||||
|
||||
char_data.resize(old_size + length);
|
||||
memcpy(&char_data[old_size], pos, length);
|
||||
getOffsets().push_back((getOffsets().size() == 0 ? 0 : getOffsets().back()) + length);
|
||||
chars.resize(old_size + length);
|
||||
memcpy(&chars[old_size], pos, length);
|
||||
offsets.push_back((offsets.size() == 0 ? 0 : offsets.back()) + length);
|
||||
}
|
||||
|
||||
ColumnPtr cut(size_t start, size_t length) const
|
||||
@ -110,30 +117,31 @@ public:
|
||||
if (length == 0)
|
||||
return new ColumnString;
|
||||
|
||||
if (start + length > getOffsets().size())
|
||||
if (start + length > offsets.size())
|
||||
throw Exception("Parameter out of bound in IColumnString::cut() method.",
|
||||
ErrorCodes::PARAMETER_OUT_OF_BOUND);
|
||||
|
||||
size_t nested_offset = offsetAt(start);
|
||||
size_t nested_length = getOffsets()[start + length - 1] - nested_offset;
|
||||
size_t nested_length = offsets[start + length - 1] - nested_offset;
|
||||
|
||||
ColumnString * res_ = new ColumnString;
|
||||
ColumnPtr res = res_;
|
||||
|
||||
ColumnPtr tmp_data = data->cut(nested_offset, nested_length);
|
||||
res_->char_data.swap(static_cast<ColumnUInt8 &>(*tmp_data).getData());
|
||||
Offsets_t & res_offsets = res_->getOffsets();
|
||||
res_->chars.resize(length);
|
||||
memcpy(&res_->chars[0], &chars[nested_offset], nested_length);
|
||||
|
||||
Offsets_t & res_offsets = res_->offsets;
|
||||
|
||||
if (start == 0)
|
||||
{
|
||||
res_offsets.assign(getOffsets().begin(), getOffsets().begin() + length);
|
||||
res_offsets.assign(offsets.begin(), offsets.begin() + length);
|
||||
}
|
||||
else
|
||||
{
|
||||
res_offsets.resize(length);
|
||||
|
||||
for (size_t i = 0; i < length; ++i)
|
||||
res_offsets[i] = getOffsets()[start + i] - nested_offset;
|
||||
res_offsets[i] = offsets[start + i] - nested_offset;
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -141,7 +149,7 @@ public:
|
||||
|
||||
ColumnPtr filter(const Filter & filt) const
|
||||
{
|
||||
size_t size = getOffsets().size();
|
||||
size_t size = offsets.size();
|
||||
if (size != filt.size())
|
||||
throw Exception("Size of filter doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
|
||||
|
||||
@ -151,9 +159,9 @@ public:
|
||||
ColumnString * res_ = new ColumnString;
|
||||
ColumnPtr res = res_;
|
||||
|
||||
ColumnUInt8::Container_t & res_chars = res_->char_data;
|
||||
Offsets_t & res_offsets = res_->getOffsets();
|
||||
res_chars.reserve(char_data.size());
|
||||
Chars_t & res_chars = res_->chars;
|
||||
Offsets_t & res_offsets = res_->offsets;
|
||||
res_chars.reserve(chars.size());
|
||||
res_offsets.reserve(size);
|
||||
|
||||
Offset_t current_new_offset = 0;
|
||||
@ -163,14 +171,14 @@ public:
|
||||
if (!filt[i])
|
||||
continue;
|
||||
|
||||
size_t string_offset = i == 0 ? 0 : getOffsets()[i - 1];
|
||||
size_t string_size = getOffsets()[i] - string_offset;
|
||||
size_t string_offset = i == 0 ? 0 : offsets[i - 1];
|
||||
size_t string_size = offsets[i] - string_offset;
|
||||
|
||||
current_new_offset += string_size;
|
||||
res_offsets.push_back(current_new_offset);
|
||||
|
||||
res_chars.resize(res_chars.size() + string_size);
|
||||
memcpy(&res_chars[res_chars.size() - string_size], &char_data[string_offset], string_size);
|
||||
memcpy(&res_chars[res_chars.size() - string_size], &chars[string_offset], string_size);
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -178,7 +186,7 @@ public:
|
||||
|
||||
ColumnPtr permute(const Permutation & perm) const
|
||||
{
|
||||
size_t size = getOffsets().size();
|
||||
size_t size = offsets.size();
|
||||
if (size != perm.size())
|
||||
throw Exception("Size of permutation doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
|
||||
|
||||
@ -188,10 +196,10 @@ public:
|
||||
ColumnString * res_ = new ColumnString;
|
||||
ColumnPtr res = res_;
|
||||
|
||||
ColumnUInt8::Container_t & res_chars = res_->char_data;
|
||||
Offsets_t & res_offsets = res_->getOffsets();
|
||||
Chars_t & res_chars = res_->chars;
|
||||
Offsets_t & res_offsets = res_->offsets;
|
||||
|
||||
res_chars.resize(char_data.size());
|
||||
res_chars.resize(chars.size());
|
||||
res_offsets.resize(size);
|
||||
|
||||
Offset_t current_new_offset = 0;
|
||||
@ -199,10 +207,10 @@ public:
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
size_t j = perm[i];
|
||||
size_t string_offset = j == 0 ? 0 : getOffsets()[j - 1];
|
||||
size_t string_size = getOffsets()[j] - string_offset;
|
||||
size_t string_offset = j == 0 ? 0 : offsets[j - 1];
|
||||
size_t string_size = offsets[j] - string_offset;
|
||||
|
||||
memcpy(&res_chars[current_new_offset], &char_data[string_offset], string_size);
|
||||
memcpy(&res_chars[current_new_offset], &chars[string_offset], string_size);
|
||||
|
||||
current_new_offset += string_size;
|
||||
res_offsets[i] = current_new_offset;
|
||||
@ -213,8 +221,8 @@ public:
|
||||
|
||||
void insertDefault()
|
||||
{
|
||||
char_data.push_back(0);
|
||||
getOffsets().push_back(getOffsets().size() == 0 ? 1 : (getOffsets().back() + 1));
|
||||
chars.push_back(0);
|
||||
offsets.push_back(offsets.size() == 0 ? 1 : (offsets.back() + 1));
|
||||
}
|
||||
|
||||
int compareAt(size_t n, size_t m, const IColumn & rhs_) const
|
||||
@ -226,8 +234,8 @@ public:
|
||||
* Замечу, что завершающий нулевой байт всегда есть.
|
||||
*/
|
||||
return strcmp(
|
||||
reinterpret_cast<const char *>(&char_data[offsetAt(n)]),
|
||||
reinterpret_cast<const char *>(&rhs.char_data[rhs.offsetAt(m)]));
|
||||
reinterpret_cast<const char *>(&chars[offsetAt(n)]),
|
||||
reinterpret_cast<const char *>(&rhs.chars[rhs.offsetAt(m)]));
|
||||
}
|
||||
|
||||
struct less
|
||||
@ -237,14 +245,14 @@ public:
|
||||
bool operator()(size_t lhs, size_t rhs) const
|
||||
{
|
||||
return 0 > strcmp(
|
||||
reinterpret_cast<const char *>(&parent.char_data[parent.offsetAt(lhs)]),
|
||||
reinterpret_cast<const char *>(&parent.char_data[parent.offsetAt(rhs)]));
|
||||
reinterpret_cast<const char *>(&parent.chars[parent.offsetAt(lhs)]),
|
||||
reinterpret_cast<const char *>(&parent.chars[parent.offsetAt(rhs)]));
|
||||
}
|
||||
};
|
||||
|
||||
Permutation getPermutation() const
|
||||
{
|
||||
size_t s = getOffsets().size();
|
||||
size_t s = offsets.size();
|
||||
Permutation res(s);
|
||||
for (size_t i = 0; i < s; ++i)
|
||||
res[i] = i;
|
||||
@ -262,9 +270,9 @@ public:
|
||||
ColumnString * res_ = new ColumnString;
|
||||
ColumnPtr res = res_;
|
||||
|
||||
ColumnUInt8::Container_t & res_chars = res_->char_data;
|
||||
Offsets_t & res_offsets = res_->getOffsets();
|
||||
res_chars.reserve(char_data.size() / col_size * replicate_offsets.back());
|
||||
Chars_t & res_chars = res_->chars;
|
||||
Offsets_t & res_offsets = res_->offsets;
|
||||
res_chars.reserve(chars.size() / col_size * replicate_offsets.back());
|
||||
res_offsets.reserve(replicate_offsets.back());
|
||||
|
||||
Offset_t prev_replicate_offset = 0;
|
||||
@ -274,7 +282,7 @@ public:
|
||||
for (size_t i = 0; i < col_size; ++i)
|
||||
{
|
||||
size_t size_to_replicate = replicate_offsets[i] - prev_replicate_offset;
|
||||
size_t string_size = getOffsets()[i] - prev_string_offset;
|
||||
size_t string_size = offsets[i] - prev_string_offset;
|
||||
|
||||
for (size_t j = 0; j < size_to_replicate; ++j)
|
||||
{
|
||||
@ -282,11 +290,11 @@ public:
|
||||
res_offsets.push_back(current_new_offset);
|
||||
|
||||
res_chars.resize(res_chars.size() + string_size);
|
||||
memcpy(&res_chars[res_chars.size() - string_size], &char_data[prev_string_offset], string_size);
|
||||
memcpy(&res_chars[res_chars.size() - string_size], &chars[prev_string_offset], string_size);
|
||||
}
|
||||
|
||||
prev_replicate_offset = replicate_offsets[i];
|
||||
prev_string_offset = getOffsets()[i];
|
||||
prev_string_offset = offsets[i];
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -294,9 +302,16 @@ public:
|
||||
|
||||
void reserve(size_t n)
|
||||
{
|
||||
getOffsets().reserve(n);
|
||||
char_data.reserve(n * DBMS_APPROX_STRING_SIZE);
|
||||
offsets.reserve(n);
|
||||
chars.reserve(n * DBMS_APPROX_STRING_SIZE);
|
||||
}
|
||||
|
||||
|
||||
Chars_t & getChars() { return chars; }
|
||||
const Chars_t & getChars() const { return chars; }
|
||||
|
||||
Offsets_t & getOffsets() { return offsets; }
|
||||
const Offsets_t & getOffsets() const { return offsets; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -168,11 +168,11 @@ private:
|
||||
block.getByPosition(result).column = col_res;
|
||||
|
||||
ArrayElementStringImpl::vector(
|
||||
dynamic_cast<const ColumnUInt8 &>(col_nested->getData()).getData(),
|
||||
col_nested->getChars(),
|
||||
col_array->getOffsets(),
|
||||
col_nested->getOffsets(),
|
||||
index,
|
||||
dynamic_cast<ColumnUInt8 &>(col_res->getData()).getData(),
|
||||
col_res->getChars(),
|
||||
col_res->getOffsets());
|
||||
|
||||
return true;
|
||||
@ -392,7 +392,7 @@ private:
|
||||
block.getByPosition(result).column = col_res;
|
||||
|
||||
ArrayIndexStringImpl<IndexConv>::vector(
|
||||
dynamic_cast<const ColumnUInt8 &>(col_nested->getData()).getData(),
|
||||
col_nested->getChars(),
|
||||
col_array->getOffsets(),
|
||||
col_nested->getOffsets(),
|
||||
safeGet<const String &>(value),
|
||||
|
@ -104,7 +104,7 @@ public:
|
||||
ColumnString * col_res = new ColumnString;
|
||||
block.getByPosition(result).column = col_res;
|
||||
|
||||
ColumnUInt8::Container_t & vec_res = dynamic_cast<ColumnUInt8 &>(col_res->getData()).getData();
|
||||
ColumnString::Chars_t & vec_res = col_res->getChars();
|
||||
ColumnString::Offsets_t & offsets_res = col_res->getOffsets();
|
||||
|
||||
vec_res.resize(vec_in.size() * 16); /// самое длинное значение: 255.255.255.255\0
|
||||
@ -201,7 +201,7 @@ public:
|
||||
ColumnVector<UInt32>::Container_t & vec_res = col_res->getData();
|
||||
vec_res.resize(col->size());
|
||||
|
||||
const ColumnString::DataVector_t & vec_src = col->getDataVector();
|
||||
const ColumnString::Chars_t & vec_src = col->getChars();
|
||||
const ColumnString::Offsets_t & offsets_src = col->getOffsets();
|
||||
size_t prev_offset = 0;
|
||||
|
||||
@ -285,7 +285,7 @@ public:
|
||||
{
|
||||
ColumnString * col_str = new ColumnString;
|
||||
col_res = col_str;
|
||||
ColumnString::DataVector_t & out_vec = col_str->getDataVector();
|
||||
ColumnString::Chars_t & out_vec = col_str->getChars();
|
||||
ColumnString::Offsets_t & out_offsets = col_str->getOffsets();
|
||||
|
||||
const typename ColumnVector<T>::Container_t & in_vec = col_vec->getData();
|
||||
@ -350,10 +350,10 @@ public:
|
||||
{
|
||||
ColumnString * col_str = new ColumnString;
|
||||
col_res = col_str;
|
||||
ColumnString::DataVector_t & out_vec = col_str->getDataVector();
|
||||
ColumnString::Chars_t & out_vec = col_str->getChars();
|
||||
ColumnString::Offsets_t & out_offsets = col_str->getOffsets();
|
||||
|
||||
const ColumnString::DataVector_t & in_vec = col_str_in->getDataVector();
|
||||
const ColumnString::Chars_t & in_vec = col_str_in->getChars();
|
||||
const ColumnString::Offsets_t & in_offsets = col_str_in->getOffsets();
|
||||
|
||||
size_t size = in_offsets.size();
|
||||
@ -477,10 +477,10 @@ public:
|
||||
ColumnString * col_res = new ColumnString;
|
||||
block.getByPosition(result).column = col_res;
|
||||
|
||||
ColumnString::DataVector_t & out_vec = col_res->getDataVector();
|
||||
ColumnString::Chars_t & out_vec = col_res->getChars();
|
||||
ColumnString::Offsets_t & out_offsets = col_res->getOffsets();
|
||||
|
||||
const ColumnString::DataVector_t & in_vec = col->getDataVector();
|
||||
const ColumnString::Chars_t & in_vec = col->getChars();
|
||||
const ColumnString::Offsets_t & in_offsets = col->getOffsets();
|
||||
|
||||
size_t size = in_offsets.size();
|
||||
|
@ -69,8 +69,8 @@ struct EqualsNumImpl
|
||||
struct EqualsStringImpl
|
||||
{
|
||||
static void string_vector_string_vector(
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_offsets.size();
|
||||
@ -82,8 +82,8 @@ struct EqualsStringImpl
|
||||
}
|
||||
|
||||
static void string_vector_fixed_string_vector(
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, ColumnArray::Offset_t b_n,
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, ColumnString::Offset_t b_n,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_offsets.size();
|
||||
@ -95,12 +95,12 @@ struct EqualsStringImpl
|
||||
}
|
||||
|
||||
static void string_vector_constant(
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::string & b,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_offsets.size();
|
||||
ColumnArray::Offset_t b_n = b.size();
|
||||
ColumnString::Offset_t b_n = b.size();
|
||||
const UInt8 * b_data = reinterpret_cast<const UInt8 *>(b.data());
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
c[i] = (i == 0)
|
||||
@ -110,8 +110,8 @@ struct EqualsStringImpl
|
||||
}
|
||||
|
||||
static void fixed_string_vector_string_vector(
|
||||
const std::vector<UInt8> & a_data, ColumnArray::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
const std::vector<UInt8> & a_data, ColumnString::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = b_offsets.size();
|
||||
@ -123,8 +123,8 @@ struct EqualsStringImpl
|
||||
}
|
||||
|
||||
static void fixed_string_vector_fixed_string_vector(
|
||||
const std::vector<UInt8> & a_data, ColumnArray::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, ColumnArray::Offset_t b_n,
|
||||
const std::vector<UInt8> & a_data, ColumnString::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, ColumnString::Offset_t b_n,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_data.size();
|
||||
@ -133,24 +133,24 @@ struct EqualsStringImpl
|
||||
}
|
||||
|
||||
static void fixed_string_vector_constant(
|
||||
const std::vector<UInt8> & a_data, ColumnArray::Offset_t a_n,
|
||||
const std::vector<UInt8> & a_data, ColumnString::Offset_t a_n,
|
||||
const std::string & b,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_data.size();
|
||||
const UInt8 * b_data = reinterpret_cast<const UInt8 *>(b.data());
|
||||
ColumnArray::Offset_t b_n = b.size();
|
||||
ColumnString::Offset_t b_n = b.size();
|
||||
for (size_t i = 0, j = 0; i < size; i += a_n, ++j)
|
||||
c[j] = a_n == b_n && !memcmp(&a_data[i], b_data, a_n);
|
||||
}
|
||||
|
||||
static void constant_string_vector(
|
||||
const std::string & a,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = b_offsets.size();
|
||||
ColumnArray::Offset_t a_n = a.size();
|
||||
ColumnString::Offset_t a_n = a.size();
|
||||
const UInt8 * a_data = reinterpret_cast<const UInt8 *>(a.data());
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
c[i] = (i == 0)
|
||||
@ -161,12 +161,12 @@ struct EqualsStringImpl
|
||||
|
||||
static void constant_fixed_string_vector(
|
||||
const std::string & a,
|
||||
const std::vector<UInt8> & b_data, ColumnArray::Offset_t b_n,
|
||||
const std::vector<UInt8> & b_data, ColumnString::Offset_t b_n,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = b_data.size();
|
||||
const UInt8 * a_data = reinterpret_cast<const UInt8 *>(a.data());
|
||||
ColumnArray::Offset_t a_n = a.size();
|
||||
ColumnString::Offset_t a_n = a.size();
|
||||
for (size_t i = 0, j = 0; i < size; i += b_n, ++j)
|
||||
c[j] = a_n == b_n && !memcmp(&b_data[i], a_data, b_n);
|
||||
}
|
||||
@ -213,8 +213,8 @@ struct NotEqualsNumImpl
|
||||
struct NotEqualsStringImpl
|
||||
{
|
||||
static void string_vector_string_vector(
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_offsets.size();
|
||||
@ -226,8 +226,8 @@ struct NotEqualsStringImpl
|
||||
}
|
||||
|
||||
static void string_vector_fixed_string_vector(
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, ColumnArray::Offset_t b_n,
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, ColumnString::Offset_t b_n,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_offsets.size();
|
||||
@ -239,12 +239,12 @@ struct NotEqualsStringImpl
|
||||
}
|
||||
|
||||
static void string_vector_constant(
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::string & b,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_offsets.size();
|
||||
ColumnArray::Offset_t b_n = b.size();
|
||||
ColumnString::Offset_t b_n = b.size();
|
||||
const UInt8 * b_data = reinterpret_cast<const UInt8 *>(b.data());
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
c[i] = !((i == 0)
|
||||
@ -254,8 +254,8 @@ struct NotEqualsStringImpl
|
||||
}
|
||||
|
||||
static void fixed_string_vector_string_vector(
|
||||
const std::vector<UInt8> & a_data, ColumnArray::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
const std::vector<UInt8> & a_data, ColumnString::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = b_offsets.size();
|
||||
@ -267,8 +267,8 @@ struct NotEqualsStringImpl
|
||||
}
|
||||
|
||||
static void fixed_string_vector_fixed_string_vector(
|
||||
const std::vector<UInt8> & a_data, ColumnArray::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, ColumnArray::Offset_t b_n,
|
||||
const std::vector<UInt8> & a_data, ColumnString::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, ColumnString::Offset_t b_n,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_data.size();
|
||||
@ -277,24 +277,24 @@ struct NotEqualsStringImpl
|
||||
}
|
||||
|
||||
static void fixed_string_vector_constant(
|
||||
const std::vector<UInt8> & a_data, ColumnArray::Offset_t a_n,
|
||||
const std::vector<UInt8> & a_data, ColumnString::Offset_t a_n,
|
||||
const std::string & b,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_data.size();
|
||||
const UInt8 * b_data = reinterpret_cast<const UInt8 *>(b.data());
|
||||
ColumnArray::Offset_t b_n = b.size();
|
||||
ColumnString::Offset_t b_n = b.size();
|
||||
for (size_t i = 0, j = 0; i < size; i += a_n, ++j)
|
||||
c[j] = !(a_n == b_n && !memcmp(&a_data[i], b_data, a_n));
|
||||
}
|
||||
|
||||
static void constant_string_vector(
|
||||
const std::string & a,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = b_offsets.size();
|
||||
ColumnArray::Offset_t a_n = a.size();
|
||||
ColumnString::Offset_t a_n = a.size();
|
||||
const UInt8 * a_data = reinterpret_cast<const UInt8 *>(a.data());
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
c[i] = !((i == 0)
|
||||
@ -305,12 +305,12 @@ struct NotEqualsStringImpl
|
||||
|
||||
static void constant_fixed_string_vector(
|
||||
const std::string & a,
|
||||
const std::vector<UInt8> & b_data, ColumnArray::Offset_t b_n,
|
||||
const std::vector<UInt8> & b_data, ColumnString::Offset_t b_n,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = b_data.size();
|
||||
const UInt8 * a_data = reinterpret_cast<const UInt8 *>(a.data());
|
||||
ColumnArray::Offset_t a_n = a.size();
|
||||
ColumnString::Offset_t a_n = a.size();
|
||||
for (size_t i = 0, j = 0; i < size; i += b_n, ++j)
|
||||
c[j] = !(a_n == b_n && !memcmp(&b_data[i], a_data, b_n));
|
||||
}
|
||||
@ -357,8 +357,8 @@ struct LessNumImpl
|
||||
struct LessStringImpl
|
||||
{
|
||||
static void string_vector_string_vector(
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_offsets.size();
|
||||
@ -379,8 +379,8 @@ struct LessStringImpl
|
||||
}
|
||||
|
||||
static void string_vector_fixed_string_vector(
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, ColumnArray::Offset_t b_n,
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, ColumnString::Offset_t b_n,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_offsets.size();
|
||||
@ -401,12 +401,12 @@ struct LessStringImpl
|
||||
}
|
||||
|
||||
static void string_vector_constant(
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::string & b,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_offsets.size();
|
||||
ColumnArray::Offset_t b_n = b.size();
|
||||
ColumnString::Offset_t b_n = b.size();
|
||||
const UInt8 * b_data = reinterpret_cast<const UInt8 *>(b.data());
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
@ -425,8 +425,8 @@ struct LessStringImpl
|
||||
}
|
||||
|
||||
static void fixed_string_vector_string_vector(
|
||||
const std::vector<UInt8> & a_data, ColumnArray::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
const std::vector<UInt8> & a_data, ColumnString::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = b_offsets.size();
|
||||
@ -447,8 +447,8 @@ struct LessStringImpl
|
||||
}
|
||||
|
||||
static void fixed_string_vector_fixed_string_vector(
|
||||
const std::vector<UInt8> & a_data, ColumnArray::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, ColumnArray::Offset_t b_n,
|
||||
const std::vector<UInt8> & a_data, ColumnString::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, ColumnString::Offset_t b_n,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_data.size();
|
||||
@ -460,13 +460,13 @@ struct LessStringImpl
|
||||
}
|
||||
|
||||
static void fixed_string_vector_constant(
|
||||
const std::vector<UInt8> & a_data, ColumnArray::Offset_t a_n,
|
||||
const std::vector<UInt8> & a_data, ColumnString::Offset_t a_n,
|
||||
const std::string & b,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_data.size();
|
||||
const UInt8 * b_data = reinterpret_cast<const UInt8 *>(b.data());
|
||||
ColumnArray::Offset_t b_n = b.size();
|
||||
ColumnString::Offset_t b_n = b.size();
|
||||
for (size_t i = 0, j = 0; i < size; i += a_n, ++j)
|
||||
{
|
||||
int res = memcmp(&a_data[i], b_data, std::min(a_n, b_n));
|
||||
@ -476,11 +476,11 @@ struct LessStringImpl
|
||||
|
||||
static void constant_string_vector(
|
||||
const std::string & a,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = b_offsets.size();
|
||||
ColumnArray::Offset_t a_n = a.size();
|
||||
ColumnString::Offset_t a_n = a.size();
|
||||
const UInt8 * a_data = reinterpret_cast<const UInt8 *>(a.data());
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
@ -500,12 +500,12 @@ struct LessStringImpl
|
||||
|
||||
static void constant_fixed_string_vector(
|
||||
const std::string & a,
|
||||
const std::vector<UInt8> & b_data, ColumnArray::Offset_t b_n,
|
||||
const std::vector<UInt8> & b_data, ColumnString::Offset_t b_n,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = b_data.size();
|
||||
const UInt8 * a_data = reinterpret_cast<const UInt8 *>(a.data());
|
||||
ColumnArray::Offset_t a_n = a.size();
|
||||
ColumnString::Offset_t a_n = a.size();
|
||||
for (size_t i = 0, j = 0; i < size; i += b_n, ++j)
|
||||
{
|
||||
int res = memcmp(a_data, &b_data[i], std::min(a_n, b_n));
|
||||
@ -555,8 +555,8 @@ struct GreaterNumImpl
|
||||
struct GreaterStringImpl
|
||||
{
|
||||
static void string_vector_string_vector(
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_offsets.size();
|
||||
@ -577,8 +577,8 @@ struct GreaterStringImpl
|
||||
}
|
||||
|
||||
static void string_vector_fixed_string_vector(
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, ColumnArray::Offset_t b_n,
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, ColumnString::Offset_t b_n,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_offsets.size();
|
||||
@ -599,12 +599,12 @@ struct GreaterStringImpl
|
||||
}
|
||||
|
||||
static void string_vector_constant(
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::string & b,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_offsets.size();
|
||||
ColumnArray::Offset_t b_n = b.size();
|
||||
ColumnString::Offset_t b_n = b.size();
|
||||
const UInt8 * b_data = reinterpret_cast<const UInt8 *>(b.data());
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
@ -623,8 +623,8 @@ struct GreaterStringImpl
|
||||
}
|
||||
|
||||
static void fixed_string_vector_string_vector(
|
||||
const std::vector<UInt8> & a_data, ColumnArray::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
const std::vector<UInt8> & a_data, ColumnString::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = b_offsets.size();
|
||||
@ -645,8 +645,8 @@ struct GreaterStringImpl
|
||||
}
|
||||
|
||||
static void fixed_string_vector_fixed_string_vector(
|
||||
const std::vector<UInt8> & a_data, ColumnArray::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, ColumnArray::Offset_t b_n,
|
||||
const std::vector<UInt8> & a_data, ColumnString::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, ColumnString::Offset_t b_n,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_data.size();
|
||||
@ -658,13 +658,13 @@ struct GreaterStringImpl
|
||||
}
|
||||
|
||||
static void fixed_string_vector_constant(
|
||||
const std::vector<UInt8> & a_data, ColumnArray::Offset_t a_n,
|
||||
const std::vector<UInt8> & a_data, ColumnString::Offset_t a_n,
|
||||
const std::string & b,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_data.size();
|
||||
const UInt8 * b_data = reinterpret_cast<const UInt8 *>(b.data());
|
||||
ColumnArray::Offset_t b_n = b.size();
|
||||
ColumnString::Offset_t b_n = b.size();
|
||||
for (size_t i = 0, j = 0; i < size; i += a_n, ++j)
|
||||
{
|
||||
int res = memcmp(&a_data[i], b_data, std::min(a_n, b_n));
|
||||
@ -674,11 +674,11 @@ struct GreaterStringImpl
|
||||
|
||||
static void constant_string_vector(
|
||||
const std::string & a,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = b_offsets.size();
|
||||
ColumnArray::Offset_t a_n = a.size();
|
||||
ColumnString::Offset_t a_n = a.size();
|
||||
const UInt8 * a_data = reinterpret_cast<const UInt8 *>(a.data());
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
@ -698,12 +698,12 @@ struct GreaterStringImpl
|
||||
|
||||
static void constant_fixed_string_vector(
|
||||
const std::string & a,
|
||||
const std::vector<UInt8> & b_data, ColumnArray::Offset_t b_n,
|
||||
const std::vector<UInt8> & b_data, ColumnString::Offset_t b_n,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = b_data.size();
|
||||
const UInt8 * a_data = reinterpret_cast<const UInt8 *>(a.data());
|
||||
ColumnArray::Offset_t a_n = a.size();
|
||||
ColumnString::Offset_t a_n = a.size();
|
||||
for (size_t i = 0, j = 0; i < size; i += b_n, ++j)
|
||||
{
|
||||
int res = memcmp(a_data, &b_data[i], std::min(a_n, b_n));
|
||||
@ -753,8 +753,8 @@ struct LessOrEqualsNumImpl
|
||||
struct LessOrEqualsStringImpl
|
||||
{
|
||||
static void string_vector_string_vector(
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_offsets.size();
|
||||
@ -775,8 +775,8 @@ struct LessOrEqualsStringImpl
|
||||
}
|
||||
|
||||
static void string_vector_fixed_string_vector(
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, ColumnArray::Offset_t b_n,
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, ColumnString::Offset_t b_n,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_offsets.size();
|
||||
@ -797,12 +797,12 @@ struct LessOrEqualsStringImpl
|
||||
}
|
||||
|
||||
static void string_vector_constant(
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::string & b,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_offsets.size();
|
||||
ColumnArray::Offset_t b_n = b.size();
|
||||
ColumnString::Offset_t b_n = b.size();
|
||||
const UInt8 * b_data = reinterpret_cast<const UInt8 *>(b.data());
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
@ -821,8 +821,8 @@ struct LessOrEqualsStringImpl
|
||||
}
|
||||
|
||||
static void fixed_string_vector_string_vector(
|
||||
const std::vector<UInt8> & a_data, ColumnArray::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
const std::vector<UInt8> & a_data, ColumnString::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = b_offsets.size();
|
||||
@ -843,8 +843,8 @@ struct LessOrEqualsStringImpl
|
||||
}
|
||||
|
||||
static void fixed_string_vector_fixed_string_vector(
|
||||
const std::vector<UInt8> & a_data, ColumnArray::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, ColumnArray::Offset_t b_n,
|
||||
const std::vector<UInt8> & a_data, ColumnString::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, ColumnString::Offset_t b_n,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_data.size();
|
||||
@ -856,13 +856,13 @@ struct LessOrEqualsStringImpl
|
||||
}
|
||||
|
||||
static void fixed_string_vector_constant(
|
||||
const std::vector<UInt8> & a_data, ColumnArray::Offset_t a_n,
|
||||
const std::vector<UInt8> & a_data, ColumnString::Offset_t a_n,
|
||||
const std::string & b,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_data.size();
|
||||
const UInt8 * b_data = reinterpret_cast<const UInt8 *>(b.data());
|
||||
ColumnArray::Offset_t b_n = b.size();
|
||||
ColumnString::Offset_t b_n = b.size();
|
||||
for (size_t i = 0, j = 0; i < size; i += a_n, ++j)
|
||||
{
|
||||
int res = memcmp(&a_data[i], b_data, std::min(a_n, b_n));
|
||||
@ -872,11 +872,11 @@ struct LessOrEqualsStringImpl
|
||||
|
||||
static void constant_string_vector(
|
||||
const std::string & a,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = b_offsets.size();
|
||||
ColumnArray::Offset_t a_n = a.size();
|
||||
ColumnString::Offset_t a_n = a.size();
|
||||
const UInt8 * a_data = reinterpret_cast<const UInt8 *>(a.data());
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
@ -896,12 +896,12 @@ struct LessOrEqualsStringImpl
|
||||
|
||||
static void constant_fixed_string_vector(
|
||||
const std::string & a,
|
||||
const std::vector<UInt8> & b_data, ColumnArray::Offset_t b_n,
|
||||
const std::vector<UInt8> & b_data, ColumnString::Offset_t b_n,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = b_data.size();
|
||||
const UInt8 * a_data = reinterpret_cast<const UInt8 *>(a.data());
|
||||
ColumnArray::Offset_t a_n = a.size();
|
||||
ColumnString::Offset_t a_n = a.size();
|
||||
for (size_t i = 0, j = 0; i < size; i += b_n, ++j)
|
||||
{
|
||||
int res = memcmp(a_data, &b_data[i], std::min(a_n, b_n));
|
||||
@ -951,8 +951,8 @@ struct GreaterOrEqualsNumImpl
|
||||
struct GreaterOrEqualsStringImpl
|
||||
{
|
||||
static void string_vector_string_vector(
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_offsets.size();
|
||||
@ -973,8 +973,8 @@ struct GreaterOrEqualsStringImpl
|
||||
}
|
||||
|
||||
static void string_vector_fixed_string_vector(
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, ColumnArray::Offset_t b_n,
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, ColumnString::Offset_t b_n,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_offsets.size();
|
||||
@ -995,12 +995,12 @@ struct GreaterOrEqualsStringImpl
|
||||
}
|
||||
|
||||
static void string_vector_constant(
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::string & b,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_offsets.size();
|
||||
ColumnArray::Offset_t b_n = b.size();
|
||||
ColumnString::Offset_t b_n = b.size();
|
||||
const UInt8 * b_data = reinterpret_cast<const UInt8 *>(b.data());
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
@ -1019,8 +1019,8 @@ struct GreaterOrEqualsStringImpl
|
||||
}
|
||||
|
||||
static void fixed_string_vector_string_vector(
|
||||
const std::vector<UInt8> & a_data, ColumnArray::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
const std::vector<UInt8> & a_data, ColumnString::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = b_offsets.size();
|
||||
@ -1041,8 +1041,8 @@ struct GreaterOrEqualsStringImpl
|
||||
}
|
||||
|
||||
static void fixed_string_vector_fixed_string_vector(
|
||||
const std::vector<UInt8> & a_data, ColumnArray::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, ColumnArray::Offset_t b_n,
|
||||
const std::vector<UInt8> & a_data, ColumnString::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, ColumnString::Offset_t b_n,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_data.size();
|
||||
@ -1054,13 +1054,13 @@ struct GreaterOrEqualsStringImpl
|
||||
}
|
||||
|
||||
static void fixed_string_vector_constant(
|
||||
const std::vector<UInt8> & a_data, ColumnArray::Offset_t a_n,
|
||||
const std::vector<UInt8> & a_data, ColumnString::Offset_t a_n,
|
||||
const std::string & b,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = a_data.size();
|
||||
const UInt8 * b_data = reinterpret_cast<const UInt8 *>(b.data());
|
||||
ColumnArray::Offset_t b_n = b.size();
|
||||
ColumnString::Offset_t b_n = b.size();
|
||||
for (size_t i = 0, j = 0; i < size; i += a_n, ++j)
|
||||
{
|
||||
int res = memcmp(&a_data[i], b_data, std::min(a_n, b_n));
|
||||
@ -1070,11 +1070,11 @@ struct GreaterOrEqualsStringImpl
|
||||
|
||||
static void constant_string_vector(
|
||||
const std::string & a,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = b_offsets.size();
|
||||
ColumnArray::Offset_t a_n = a.size();
|
||||
ColumnString::Offset_t a_n = a.size();
|
||||
const UInt8 * a_data = reinterpret_cast<const UInt8 *>(a.data());
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
@ -1094,12 +1094,12 @@ struct GreaterOrEqualsStringImpl
|
||||
|
||||
static void constant_fixed_string_vector(
|
||||
const std::string & a,
|
||||
const std::vector<UInt8> & b_data, ColumnArray::Offset_t b_n,
|
||||
const std::vector<UInt8> & b_data, ColumnString::Offset_t b_n,
|
||||
std::vector<UInt8> & c)
|
||||
{
|
||||
size_t size = b_data.size();
|
||||
const UInt8 * a_data = reinterpret_cast<const UInt8 *>(a.data());
|
||||
ColumnArray::Offset_t a_n = a.size();
|
||||
ColumnString::Offset_t a_n = a.size();
|
||||
for (size_t i = 0, j = 0; i < size; i += b_n, ++j)
|
||||
{
|
||||
int res = memcmp(a_data, &b_data[i], std::min(a_n, b_n));
|
||||
@ -1255,43 +1255,43 @@ private:
|
||||
|
||||
if (c0_string && c1_string)
|
||||
StringImpl::string_vector_string_vector(
|
||||
dynamic_cast<ColumnUInt8 &>(c0_string->getData()).getData(), c0_string->getOffsets(),
|
||||
dynamic_cast<ColumnUInt8 &>(c1_string->getData()).getData(), c1_string->getOffsets(),
|
||||
c0_string->getChars(), c0_string->getOffsets(),
|
||||
c1_string->getChars(), c1_string->getOffsets(),
|
||||
c_res->getData());
|
||||
else if (c0_string && c1_fixed_string)
|
||||
StringImpl::string_vector_fixed_string_vector(
|
||||
dynamic_cast<ColumnUInt8 &>(c0_string->getData()).getData(), c0_string->getOffsets(),
|
||||
dynamic_cast<ColumnUInt8 &>(c1_fixed_string->getData()).getData(), c1_fixed_string->getN(),
|
||||
c0_string->getChars(), c0_string->getOffsets(),
|
||||
c1_fixed_string->getChars(), c1_fixed_string->getN(),
|
||||
c_res->getData());
|
||||
else if (c0_string && c1_const)
|
||||
StringImpl::string_vector_constant(
|
||||
dynamic_cast<ColumnUInt8 &>(c0_string->getData()).getData(), c0_string->getOffsets(),
|
||||
c0_string->getChars(), c0_string->getOffsets(),
|
||||
c1_const->getData(),
|
||||
c_res->getData());
|
||||
else if (c0_fixed_string && c1_string)
|
||||
StringImpl::fixed_string_vector_string_vector(
|
||||
dynamic_cast<ColumnUInt8 &>(c0_fixed_string->getData()).getData(), c0_fixed_string->getN(),
|
||||
dynamic_cast<ColumnUInt8 &>(c1_string->getData()).getData(), c1_string->getOffsets(),
|
||||
c0_fixed_string->getChars(), c0_fixed_string->getN(),
|
||||
c1_string->getChars(), c1_string->getOffsets(),
|
||||
c_res->getData());
|
||||
else if (c0_fixed_string && c1_fixed_string)
|
||||
StringImpl::fixed_string_vector_fixed_string_vector(
|
||||
dynamic_cast<ColumnUInt8 &>(c0_fixed_string->getData()).getData(), c0_fixed_string->getN(),
|
||||
dynamic_cast<ColumnUInt8 &>(c1_fixed_string->getData()).getData(), c1_fixed_string->getN(),
|
||||
c0_fixed_string->getChars(), c0_fixed_string->getN(),
|
||||
c1_fixed_string->getChars(), c1_fixed_string->getN(),
|
||||
c_res->getData());
|
||||
else if (c0_fixed_string && c1_const)
|
||||
StringImpl::fixed_string_vector_constant(
|
||||
dynamic_cast<ColumnUInt8 &>(c0_fixed_string->getData()).getData(), c0_fixed_string->getN(),
|
||||
c0_fixed_string->getChars(), c0_fixed_string->getN(),
|
||||
c1_const->getData(),
|
||||
c_res->getData());
|
||||
else if (c0_const && c1_string)
|
||||
StringImpl::constant_string_vector(
|
||||
c0_const->getData(),
|
||||
dynamic_cast<ColumnUInt8 &>(c1_string->getData()).getData(), c1_string->getOffsets(),
|
||||
c1_string->getChars(), c1_string->getOffsets(),
|
||||
c_res->getData());
|
||||
else if (c0_const && c1_fixed_string)
|
||||
StringImpl::constant_fixed_string_vector(
|
||||
c0_const->getData(),
|
||||
dynamic_cast<ColumnUInt8 &>(c1_fixed_string->getData()).getData(), c1_fixed_string->getN(),
|
||||
c1_fixed_string->getChars(), c1_fixed_string->getN(),
|
||||
c_res->getData());
|
||||
else
|
||||
throw Exception("Illegal columns "
|
||||
|
@ -66,17 +66,17 @@ struct StringIfImpl
|
||||
{
|
||||
static void vector_vector(
|
||||
const std::vector<UInt8> & cond,
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c_data, ColumnArray::Offsets_t & c_offsets)
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c_data, ColumnString::Offsets_t & c_offsets)
|
||||
{
|
||||
size_t size = cond.size();
|
||||
c_offsets.resize(size);
|
||||
c_data.reserve(std::max(a_data.size(), b_data.size()));
|
||||
|
||||
ColumnArray::Offset_t a_prev_offset = 0;
|
||||
ColumnArray::Offset_t b_prev_offset = 0;
|
||||
ColumnArray::Offset_t c_prev_offset = 0;
|
||||
ColumnString::Offset_t a_prev_offset = 0;
|
||||
ColumnString::Offset_t b_prev_offset = 0;
|
||||
ColumnString::Offset_t c_prev_offset = 0;
|
||||
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
@ -104,16 +104,16 @@ struct StringIfImpl
|
||||
|
||||
static void vector_constant(
|
||||
const std::vector<UInt8> & cond,
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const String & b,
|
||||
std::vector<UInt8> & c_data, ColumnArray::Offsets_t & c_offsets)
|
||||
std::vector<UInt8> & c_data, ColumnString::Offsets_t & c_offsets)
|
||||
{
|
||||
size_t size = cond.size();
|
||||
c_offsets.resize(size);
|
||||
c_data.reserve(a_data.size());
|
||||
|
||||
ColumnArray::Offset_t a_prev_offset = 0;
|
||||
ColumnArray::Offset_t c_prev_offset = 0;
|
||||
ColumnString::Offset_t a_prev_offset = 0;
|
||||
ColumnString::Offset_t c_prev_offset = 0;
|
||||
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
@ -141,15 +141,15 @@ struct StringIfImpl
|
||||
static void constant_vector(
|
||||
const std::vector<UInt8> & cond,
|
||||
const String & a,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c_data, ColumnArray::Offsets_t & c_offsets)
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c_data, ColumnString::Offsets_t & c_offsets)
|
||||
{
|
||||
size_t size = cond.size();
|
||||
c_offsets.resize(size);
|
||||
c_data.reserve(b_data.size());
|
||||
|
||||
ColumnArray::Offset_t b_prev_offset = 0;
|
||||
ColumnArray::Offset_t c_prev_offset = 0;
|
||||
ColumnString::Offset_t b_prev_offset = 0;
|
||||
ColumnString::Offset_t c_prev_offset = 0;
|
||||
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
@ -177,13 +177,13 @@ struct StringIfImpl
|
||||
static void constant_constant(
|
||||
const std::vector<UInt8> & cond,
|
||||
const String & a, const String & b,
|
||||
std::vector<UInt8> & c_data, ColumnArray::Offsets_t & c_offsets)
|
||||
std::vector<UInt8> & c_data, ColumnString::Offsets_t & c_offsets)
|
||||
{
|
||||
size_t size = cond.size();
|
||||
c_offsets.resize(size);
|
||||
c_data.reserve((std::max(a.size(), b.size()) + 1) * size);
|
||||
|
||||
ColumnArray::Offset_t c_prev_offset = 0;
|
||||
ColumnString::Offset_t c_prev_offset = 0;
|
||||
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
@ -249,26 +249,26 @@ private:
|
||||
ColumnString * col_res = new ColumnString;
|
||||
block.getByPosition(result).column = col_res;
|
||||
|
||||
std::vector<UInt8> & res_vec = dynamic_cast<ColumnUInt8 &>(col_res->getData()).getData();
|
||||
ColumnArray::Offsets_t & res_offsets = col_res->getOffsets();
|
||||
ColumnString::Chars_t & res_vec = col_res->getChars();
|
||||
ColumnString::Offsets_t & res_offsets = col_res->getOffsets();
|
||||
|
||||
if (col_then && col_else)
|
||||
StringIfImpl::vector_vector(
|
||||
cond_col->getData(),
|
||||
dynamic_cast<const ColumnUInt8 &>(col_then->getData()).getData(), col_then->getOffsets(),
|
||||
dynamic_cast<const ColumnUInt8 &>(col_else->getData()).getData(), col_else->getOffsets(),
|
||||
col_then->getChars(), col_then->getOffsets(),
|
||||
col_else->getChars(), col_else->getOffsets(),
|
||||
res_vec, res_offsets);
|
||||
else if (col_then && col_else_const)
|
||||
StringIfImpl::vector_constant(
|
||||
cond_col->getData(),
|
||||
dynamic_cast<const ColumnUInt8 &>(col_then->getData()).getData(), col_then->getOffsets(),
|
||||
col_then->getChars(), col_then->getOffsets(),
|
||||
col_else_const->getData(),
|
||||
res_vec, res_offsets);
|
||||
else if (col_then_const && col_else)
|
||||
StringIfImpl::constant_vector(
|
||||
cond_col->getData(),
|
||||
col_then_const->getData(),
|
||||
dynamic_cast<const ColumnUInt8 &>(col_else->getData()).getData(), col_else->getOffsets(),
|
||||
col_else->getChars(), col_else->getOffsets(),
|
||||
res_vec, res_offsets);
|
||||
else if (col_then_const && col_else_const)
|
||||
StringIfImpl::constant_constant(
|
||||
|
@ -155,7 +155,7 @@ struct ConvertImpl<FromDataType, DataTypeString, Name>
|
||||
block.getByPosition(result).column = col_to;
|
||||
|
||||
const typename ColumnVector<FromFieldType>::Container_t & vec_from = col_from->getData();
|
||||
ColumnUInt8::Container_t & data_to = dynamic_cast<ColumnUInt8 &>(col_to->getData()).getData();
|
||||
ColumnString::Chars_t & data_to = col_to->getChars();
|
||||
ColumnString::Offsets_t & offsets_to = col_to->getOffsets();
|
||||
size_t size = vec_from.size();
|
||||
data_to.resize(size * 2);
|
||||
@ -216,7 +216,7 @@ struct ConvertImpl<DataTypeString, ToDataType, Name>
|
||||
ColumnVector<ToFieldType> * col_to = new ColumnVector<ToFieldType>;
|
||||
block.getByPosition(result).column = col_to;
|
||||
|
||||
const ColumnUInt8::Container_t & data_from = dynamic_cast<const ColumnUInt8 &>(col_from->getData()).getData();
|
||||
const ColumnString::Chars_t & data_from = col_from->getChars();
|
||||
typename ColumnVector<ToFieldType>::Container_t & vec_to = col_to->getData();
|
||||
size_t size = col_from->size();
|
||||
vec_to.resize(size);
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
block.getByPosition(result).column = col_to;
|
||||
|
||||
const typename ColumnVector<T>::Container_t & vec_from = col_from->getData();
|
||||
ColumnUInt8::Container_t & data_to = dynamic_cast<ColumnUInt8 &>(col_to->getData()).getData();
|
||||
ColumnString::Chars_t & data_to = col_to->getChars();
|
||||
ColumnString::Offsets_t & offsets_to = col_to->getOffsets();
|
||||
size_t size = vec_from.size();
|
||||
data_to.resize(size * 2);
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
ColumnUInt64 * col_to = new ColumnUInt64;
|
||||
block.getByPosition(result).column = col_to;
|
||||
|
||||
const typename ColumnUInt8::Container_t & data = dynamic_cast<const ColumnUInt8 &>(col_from->getData()).getData();
|
||||
const typename ColumnString::Chars_t & data = col_from->getChars();
|
||||
const typename ColumnString::Offsets_t & offsets = col_from->getOffsets();
|
||||
typename ColumnUInt64::Container_t & vec_to = col_to->getData();
|
||||
size_t size = offsets.size();
|
||||
|
@ -115,7 +115,7 @@ static inline UInt64 stringWidth(const UInt8 * pos, const UInt8 * end)
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline void stringWidthVector(const std::vector<UInt8> & data, const ColumnArray::Offsets_t & offsets, std::vector<UInt64> & res)
|
||||
static inline void stringWidthVector(const std::vector<UInt8> & data, const ColumnString::Offsets_t & offsets, std::vector<UInt64> & res)
|
||||
{
|
||||
size_t size = offsets.size();
|
||||
|
||||
@ -229,13 +229,13 @@ public:
|
||||
else if (const ColumnString * col = dynamic_cast<const ColumnString *>(&*column))
|
||||
{
|
||||
ColumnUInt64 * res = new ColumnUInt64(rows);
|
||||
stringWidthVector(dynamic_cast<const ColumnUInt8 &>(col->getData()).getData(), col->getOffsets(), res->getData());
|
||||
stringWidthVector(col->getChars(), col->getOffsets(), res->getData());
|
||||
block.getByPosition(result).column = res;
|
||||
}
|
||||
else if (const ColumnFixedString * col = dynamic_cast<const ColumnFixedString *>(&*column))
|
||||
{
|
||||
ColumnUInt64 * res = new ColumnUInt64(rows);
|
||||
stringWidthFixedVector(dynamic_cast<const ColumnUInt8 &>(col->getData()).getData(), col->getN(), res->getData());
|
||||
stringWidthFixedVector(col->getChars(), col->getN(), res->getData());
|
||||
block.getByPosition(result).column = res;
|
||||
}
|
||||
else if (const ColumnConstString * col = dynamic_cast<const ColumnConstString *>(&*column))
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
block.getByPosition(result).column = col_to;
|
||||
|
||||
const typename ColumnVector<T>::Container_t & vec_from = col_from->getData();
|
||||
ColumnUInt8::Container_t & data_to = dynamic_cast<ColumnUInt8 &>(col_to->getData()).getData();
|
||||
ColumnString::Chars_t & data_to = col_to->getChars();
|
||||
ColumnString::Offsets_t & offsets_to = col_to->getOffsets();
|
||||
size_t size = vec_from.size();
|
||||
data_to.resize(size * (sizeof(T) + 1));
|
||||
@ -149,7 +149,7 @@ public:
|
||||
ColumnVector<ToFieldType> * col_res = new ColumnVector<ToFieldType>;
|
||||
block.getByPosition(result).column = col_res;
|
||||
|
||||
ColumnUInt8::Container_t & data_from = dynamic_cast<ColumnUInt8 &>(col_from->getData()).getData();
|
||||
ColumnString::Chars_t & data_from = col_from->getChars();
|
||||
ColumnString::Offsets_t & offsets_from = col_from->getOffsets();
|
||||
size_t size = offsets_from.size();
|
||||
typename ColumnVector<ToFieldType>::Container_t & vec_res = col_res->getData();
|
||||
@ -169,7 +169,7 @@ public:
|
||||
ColumnVector<ToFieldType> * col_res = new ColumnVector<ToFieldType>;
|
||||
block.getByPosition(result).column = col_res;
|
||||
|
||||
ColumnUInt8::Container_t & data_from = dynamic_cast<ColumnUInt8 &>(col_from->getData()).getData();
|
||||
ColumnString::Chars_t & data_from = col_from->getChars();
|
||||
size_t step = col_from->getN();
|
||||
size_t size = data_from.size() / step;
|
||||
typename ColumnVector<ToFieldType>::Container_t & vec_res = col_res->getData();
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <DB/DataTypes/DataTypeFixedString.h>
|
||||
#include <DB/DataTypes/DataTypeArray.h>
|
||||
#include <DB/Columns/ColumnString.h>
|
||||
#include <DB/Columns/ColumnArray.h>
|
||||
#include <DB/Columns/ColumnFixedString.h>
|
||||
#include <DB/Columns/ColumnConst.h>
|
||||
#include <DB/Functions/IFunction.h>
|
||||
@ -45,11 +46,11 @@ namespace DB
|
||||
template <bool negative = false>
|
||||
struct EmptyImpl
|
||||
{
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnArray::Offsets_t & offsets,
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnString::Offsets_t & offsets,
|
||||
std::vector<UInt8> & res)
|
||||
{
|
||||
size_t size = offsets.size();
|
||||
ColumnArray::Offset_t prev_offset = 1;
|
||||
ColumnString::Offset_t prev_offset = 1;
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
res[i] = negative ^ (offsets[i] == prev_offset);
|
||||
@ -73,10 +74,10 @@ struct EmptyImpl
|
||||
res = negative ^ (data.empty());
|
||||
}
|
||||
|
||||
static void array(const ColumnArray::Offsets_t & offsets, std::vector<UInt8> & res)
|
||||
static void array(const ColumnString::Offsets_t & offsets, std::vector<UInt8> & res)
|
||||
{
|
||||
size_t size = offsets.size();
|
||||
ColumnArray::Offset_t prev_offset = 0;
|
||||
ColumnString::Offset_t prev_offset = 0;
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
res[i] = negative ^ (offsets[i] == prev_offset);
|
||||
@ -95,7 +96,7 @@ struct EmptyImpl
|
||||
*/
|
||||
struct LengthImpl
|
||||
{
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnArray::Offsets_t & offsets,
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnString::Offsets_t & offsets,
|
||||
std::vector<UInt64> & res)
|
||||
{
|
||||
size_t size = offsets.size();
|
||||
@ -121,7 +122,7 @@ struct LengthImpl
|
||||
res = data.size();
|
||||
}
|
||||
|
||||
static void array(const ColumnArray::Offsets_t & offsets, std::vector<UInt64> & res)
|
||||
static void array(const ColumnString::Offsets_t & offsets, std::vector<UInt64> & res)
|
||||
{
|
||||
size_t size = offsets.size();
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
@ -143,12 +144,12 @@ struct LengthImpl
|
||||
*/
|
||||
struct LengthUTF8Impl
|
||||
{
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnArray::Offsets_t & offsets,
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnString::Offsets_t & offsets,
|
||||
std::vector<UInt64> & res)
|
||||
{
|
||||
size_t size = offsets.size();
|
||||
|
||||
ColumnArray::Offset_t prev_offset = 0;
|
||||
ColumnString::Offset_t prev_offset = 0;
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
res[i] = 0;
|
||||
@ -186,7 +187,7 @@ struct LengthUTF8Impl
|
||||
++res;
|
||||
}
|
||||
|
||||
static void array(const ColumnArray::Offsets_t & offsets, std::vector<UInt64> & res)
|
||||
static void array(const ColumnString::Offsets_t & offsets, std::vector<UInt64> & res)
|
||||
{
|
||||
throw Exception("Cannot apply function lengthUTF8 to Array argument", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
}
|
||||
@ -203,8 +204,8 @@ struct LengthUTF8Impl
|
||||
template <int F(int)>
|
||||
struct LowerUpperImpl
|
||||
{
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnArray::Offsets_t & offsets,
|
||||
std::vector<UInt8> & res_data, ColumnArray::Offsets_t & res_offsets)
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnString::Offsets_t & offsets,
|
||||
std::vector<UInt8> & res_data, ColumnString::Offsets_t & res_offsets)
|
||||
{
|
||||
res_data.resize(data.size());
|
||||
res_offsets = offsets;
|
||||
@ -242,8 +243,8 @@ private:
|
||||
template <int F(int)>
|
||||
struct LowerUpperUTF8Impl
|
||||
{
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnArray::Offsets_t & offsets,
|
||||
std::vector<UInt8> & res_data, ColumnArray::Offsets_t & res_offsets)
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnString::Offsets_t & offsets,
|
||||
std::vector<UInt8> & res_data, ColumnString::Offsets_t & res_offsets)
|
||||
{
|
||||
res_data.resize(data.size());
|
||||
res_offsets = offsets;
|
||||
@ -291,14 +292,14 @@ private:
|
||||
*/
|
||||
struct ReverseImpl
|
||||
{
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnArray::Offsets_t & offsets,
|
||||
std::vector<UInt8> & res_data, ColumnArray::Offsets_t & res_offsets)
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnString::Offsets_t & offsets,
|
||||
std::vector<UInt8> & res_data, ColumnString::Offsets_t & res_offsets)
|
||||
{
|
||||
res_data.resize(data.size());
|
||||
res_offsets = offsets;
|
||||
size_t size = offsets.size();
|
||||
|
||||
ColumnArray::Offset_t prev_offset = 0;
|
||||
ColumnString::Offset_t prev_offset = 0;
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
for (size_t j = prev_offset; j < offsets[i] - 1; ++j)
|
||||
@ -334,17 +335,17 @@ struct ReverseImpl
|
||||
*/
|
||||
struct ReverseUTF8Impl
|
||||
{
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnArray::Offsets_t & offsets,
|
||||
std::vector<UInt8> & res_data, ColumnArray::Offsets_t & res_offsets)
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnString::Offsets_t & offsets,
|
||||
std::vector<UInt8> & res_data, ColumnString::Offsets_t & res_offsets)
|
||||
{
|
||||
res_data.resize(data.size());
|
||||
res_offsets = offsets;
|
||||
size_t size = offsets.size();
|
||||
|
||||
ColumnArray::Offset_t prev_offset = 0;
|
||||
ColumnString::Offset_t prev_offset = 0;
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
ColumnArray::Offset_t j = prev_offset;
|
||||
ColumnString::Offset_t j = prev_offset;
|
||||
while (j < offsets[i] - 1)
|
||||
{
|
||||
if (data[j] < 0xBF)
|
||||
@ -417,17 +418,17 @@ struct ReverseUTF8Impl
|
||||
struct ConcatImpl
|
||||
{
|
||||
static void vector_vector(
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c_data, ColumnArray::Offsets_t & c_offsets)
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c_data, ColumnString::Offsets_t & c_offsets)
|
||||
{
|
||||
size_t size = a_offsets.size();
|
||||
c_data.resize(a_data.size() + b_data.size() - size);
|
||||
c_offsets.resize(size);
|
||||
|
||||
ColumnArray::Offset_t offset = 0;
|
||||
ColumnArray::Offset_t a_offset = 0;
|
||||
ColumnArray::Offset_t b_offset = 0;
|
||||
ColumnString::Offset_t offset = 0;
|
||||
ColumnString::Offset_t a_offset = 0;
|
||||
ColumnString::Offset_t b_offset = 0;
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
memcpy(&c_data[offset], &a_data[a_offset], a_offsets[i] - a_offset - 1);
|
||||
@ -443,17 +444,17 @@ struct ConcatImpl
|
||||
}
|
||||
|
||||
static void vector_fixed_vector(
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, ColumnArray::Offset_t b_n,
|
||||
std::vector<UInt8> & c_data, ColumnArray::Offsets_t & c_offsets)
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & b_data, ColumnString::Offset_t b_n,
|
||||
std::vector<UInt8> & c_data, ColumnString::Offsets_t & c_offsets)
|
||||
{
|
||||
size_t size = a_offsets.size();
|
||||
c_data.resize(a_data.size() + b_data.size());
|
||||
c_offsets.resize(size);
|
||||
|
||||
ColumnArray::Offset_t offset = 0;
|
||||
ColumnArray::Offset_t a_offset = 0;
|
||||
ColumnArray::Offset_t b_offset = 0;
|
||||
ColumnString::Offset_t offset = 0;
|
||||
ColumnString::Offset_t a_offset = 0;
|
||||
ColumnString::Offset_t b_offset = 0;
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
memcpy(&c_data[offset], &a_data[a_offset], a_offsets[i] - a_offset - 1);
|
||||
@ -471,9 +472,9 @@ struct ConcatImpl
|
||||
}
|
||||
|
||||
static void vector_constant(
|
||||
const std::vector<UInt8> & a_data, const ColumnArray::Offsets_t & a_offsets,
|
||||
const std::vector<UInt8> & a_data, const ColumnString::Offsets_t & a_offsets,
|
||||
const std::string & b,
|
||||
std::vector<UInt8> & c_data, ColumnArray::Offsets_t & c_offsets)
|
||||
std::vector<UInt8> & c_data, ColumnString::Offsets_t & c_offsets)
|
||||
{
|
||||
size_t size = a_offsets.size();
|
||||
c_data.resize(a_data.size() + b.size() * size);
|
||||
@ -482,8 +483,8 @@ struct ConcatImpl
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
c_offsets[i] += b.size() * (i + 1);
|
||||
|
||||
ColumnArray::Offset_t offset = 0;
|
||||
ColumnArray::Offset_t a_offset = 0;
|
||||
ColumnString::Offset_t offset = 0;
|
||||
ColumnString::Offset_t a_offset = 0;
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
memcpy(&c_data[offset], &a_data[a_offset], a_offsets[i] - a_offset - 1);
|
||||
@ -496,17 +497,17 @@ struct ConcatImpl
|
||||
}
|
||||
|
||||
static void fixed_vector_vector(
|
||||
const std::vector<UInt8> & a_data, ColumnArray::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c_data, ColumnArray::Offsets_t & c_offsets)
|
||||
const std::vector<UInt8> & a_data, ColumnString::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c_data, ColumnString::Offsets_t & c_offsets)
|
||||
{
|
||||
size_t size = b_offsets.size();
|
||||
c_data.resize(a_data.size() + b_data.size());
|
||||
c_offsets.resize(size);
|
||||
|
||||
ColumnArray::Offset_t offset = 0;
|
||||
ColumnArray::Offset_t a_offset = 0;
|
||||
ColumnArray::Offset_t b_offset = 0;
|
||||
ColumnString::Offset_t offset = 0;
|
||||
ColumnString::Offset_t a_offset = 0;
|
||||
ColumnString::Offset_t b_offset = 0;
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
memcpy(&c_data[offset], &a_data[a_offset], a_n);
|
||||
@ -522,13 +523,13 @@ struct ConcatImpl
|
||||
}
|
||||
|
||||
static void fixed_vector_fixed_vector(
|
||||
const std::vector<UInt8> & a_data, ColumnArray::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, ColumnArray::Offset_t b_n,
|
||||
const std::vector<UInt8> & a_data, ColumnString::Offset_t a_n,
|
||||
const std::vector<UInt8> & b_data, ColumnString::Offset_t b_n,
|
||||
std::vector<UInt8> & c_data)
|
||||
{
|
||||
size_t size = a_data.size() / a_n;
|
||||
c_data.resize(a_data.size() + b_data.size());
|
||||
ColumnArray::Offset_t c_n = a_n + b_n;
|
||||
ColumnString::Offset_t c_n = a_n + b_n;
|
||||
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
@ -538,13 +539,13 @@ struct ConcatImpl
|
||||
}
|
||||
|
||||
static void fixed_vector_constant(
|
||||
const std::vector<UInt8> & a_data, ColumnArray::Offset_t a_n,
|
||||
const std::vector<UInt8> & a_data, ColumnString::Offset_t a_n,
|
||||
const std::string & b,
|
||||
std::vector<UInt8> & c_data)
|
||||
{
|
||||
size_t size = a_data.size() / a_n;
|
||||
ColumnArray::Offset_t b_n = b.size();
|
||||
ColumnArray::Offset_t c_n = a_n + b_n;
|
||||
ColumnString::Offset_t b_n = b.size();
|
||||
ColumnString::Offset_t c_n = a_n + b_n;
|
||||
c_data.resize(a_data.size() + size * b_n);
|
||||
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
@ -556,8 +557,8 @@ struct ConcatImpl
|
||||
|
||||
static void constant_vector(
|
||||
const std::string & a,
|
||||
const std::vector<UInt8> & b_data, const ColumnArray::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c_data, ColumnArray::Offsets_t & c_offsets)
|
||||
const std::vector<UInt8> & b_data, const ColumnString::Offsets_t & b_offsets,
|
||||
std::vector<UInt8> & c_data, ColumnString::Offsets_t & c_offsets)
|
||||
{
|
||||
size_t size = b_offsets.size();
|
||||
c_data.resize(b_data.size() + a.size() * size);
|
||||
@ -566,8 +567,8 @@ struct ConcatImpl
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
c_offsets[i] += a.size() * (i + 1);
|
||||
|
||||
ColumnArray::Offset_t offset = 0;
|
||||
ColumnArray::Offset_t b_offset = 0;
|
||||
ColumnString::Offset_t offset = 0;
|
||||
ColumnString::Offset_t b_offset = 0;
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
memcpy(&c_data[offset], a.data(), a.size());
|
||||
@ -581,12 +582,12 @@ struct ConcatImpl
|
||||
|
||||
static void constant_fixed_vector(
|
||||
const std::string & a,
|
||||
const std::vector<UInt8> & b_data, ColumnArray::Offset_t b_n,
|
||||
const std::vector<UInt8> & b_data, ColumnString::Offset_t b_n,
|
||||
std::vector<UInt8> & c_data)
|
||||
{
|
||||
size_t size = b_data.size() / b_n;
|
||||
ColumnArray::Offset_t a_n = a.size();
|
||||
ColumnArray::Offset_t c_n = a_n + b_n;
|
||||
ColumnString::Offset_t a_n = a.size();
|
||||
ColumnString::Offset_t c_n = a_n + b_n;
|
||||
c_data.resize(size * a_n + b_data.size());
|
||||
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
@ -610,16 +611,16 @@ struct ConcatImpl
|
||||
*/
|
||||
struct SubstringImpl
|
||||
{
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnArray::Offsets_t & offsets,
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnString::Offsets_t & offsets,
|
||||
size_t start, size_t length,
|
||||
std::vector<UInt8> & res_data, ColumnArray::Offsets_t & res_offsets)
|
||||
std::vector<UInt8> & res_data, ColumnString::Offsets_t & res_offsets)
|
||||
{
|
||||
res_data.reserve(data.size());
|
||||
size_t size = offsets.size();
|
||||
res_offsets.resize(size);
|
||||
|
||||
ColumnArray::Offset_t prev_offset = 0;
|
||||
ColumnArray::Offset_t res_offset = 0;
|
||||
ColumnString::Offset_t prev_offset = 0;
|
||||
ColumnString::Offset_t res_offset = 0;
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
if (start + prev_offset >= offsets[i] + 1)
|
||||
@ -672,22 +673,22 @@ struct SubstringImpl
|
||||
*/
|
||||
struct SubstringUTF8Impl
|
||||
{
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnArray::Offsets_t & offsets,
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnString::Offsets_t & offsets,
|
||||
size_t start, size_t length,
|
||||
std::vector<UInt8> & res_data, ColumnArray::Offsets_t & res_offsets)
|
||||
std::vector<UInt8> & res_data, ColumnString::Offsets_t & res_offsets)
|
||||
{
|
||||
res_data.reserve(data.size());
|
||||
size_t size = offsets.size();
|
||||
res_offsets.resize(size);
|
||||
|
||||
ColumnArray::Offset_t prev_offset = 0;
|
||||
ColumnArray::Offset_t res_offset = 0;
|
||||
ColumnString::Offset_t prev_offset = 0;
|
||||
ColumnString::Offset_t res_offset = 0;
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
ColumnArray::Offset_t j = prev_offset;
|
||||
ColumnArray::Offset_t pos = 1;
|
||||
ColumnArray::Offset_t bytes_start = 0;
|
||||
ColumnArray::Offset_t bytes_length = 0;
|
||||
ColumnString::Offset_t j = prev_offset;
|
||||
ColumnString::Offset_t pos = 1;
|
||||
ColumnString::Offset_t bytes_start = 0;
|
||||
ColumnString::Offset_t bytes_length = 0;
|
||||
while (j < offsets[i] - 1)
|
||||
{
|
||||
if (pos == start)
|
||||
@ -729,7 +730,7 @@ struct SubstringUTF8Impl
|
||||
}
|
||||
}
|
||||
|
||||
static void vector_fixed(const std::vector<UInt8> & data, ColumnArray::Offset_t n,
|
||||
static void vector_fixed(const std::vector<UInt8> & data, ColumnString::Offset_t n,
|
||||
size_t start, size_t length,
|
||||
std::vector<UInt8> & res_data)
|
||||
{
|
||||
@ -743,10 +744,10 @@ struct SubstringUTF8Impl
|
||||
if (start + length > data.size() + 1)
|
||||
throw Exception("Index out of bound for function substring of constant value", ErrorCodes::ARGUMENT_OUT_OF_BOUND);
|
||||
|
||||
ColumnArray::Offset_t j = 0;
|
||||
ColumnArray::Offset_t pos = 1;
|
||||
ColumnArray::Offset_t bytes_start = 0;
|
||||
ColumnArray::Offset_t bytes_length = 0;
|
||||
ColumnString::Offset_t j = 0;
|
||||
ColumnString::Offset_t pos = 1;
|
||||
ColumnString::Offset_t bytes_start = 0;
|
||||
ColumnString::Offset_t bytes_length = 0;
|
||||
while (j < data.size())
|
||||
{
|
||||
if (pos == start)
|
||||
@ -812,7 +813,7 @@ public:
|
||||
|
||||
typename ColumnVector<ResultType>::Container_t & vec_res = col_res->getData();
|
||||
vec_res.resize(col->size());
|
||||
Impl::vector(dynamic_cast<const ColumnUInt8 &>(col->getData()).getData(), col->getOffsets(), vec_res);
|
||||
Impl::vector(col->getChars(), col->getOffsets(), vec_res);
|
||||
}
|
||||
else if (const ColumnFixedString * col = dynamic_cast<const ColumnFixedString *>(&*column))
|
||||
{
|
||||
@ -820,7 +821,7 @@ public:
|
||||
if ("lengthUTF8" != getName())
|
||||
{
|
||||
ResultType res = 0;
|
||||
Impl::vector_fixed_to_constant(dynamic_cast<const ColumnUInt8 &>(col->getData()).getData(), col->getN(), res);
|
||||
Impl::vector_fixed_to_constant(col->getChars(), col->getN(), res);
|
||||
|
||||
ColumnConst<ResultType> * col_res = new ColumnConst<ResultType>(col->size(), res);
|
||||
block.getByPosition(result).column = col_res;
|
||||
@ -832,7 +833,7 @@ public:
|
||||
|
||||
typename ColumnVector<ResultType>::Container_t & vec_res = col_res->getData();
|
||||
vec_res.resize(col->size());
|
||||
Impl::vector_fixed_to_vector(dynamic_cast<const ColumnUInt8 &>(col->getData()).getData(), col->getN(), vec_res);
|
||||
Impl::vector_fixed_to_vector(col->getChars(), col->getN(), vec_res);
|
||||
}
|
||||
}
|
||||
else if (const ColumnConstString * col = dynamic_cast<const ColumnConstString *>(&*column))
|
||||
@ -901,15 +902,15 @@ public:
|
||||
{
|
||||
ColumnString * col_res = new ColumnString;
|
||||
block.getByPosition(result).column = col_res;
|
||||
Impl::vector(dynamic_cast<const ColumnUInt8 &>(col->getData()).getData(), col->getOffsets(),
|
||||
dynamic_cast<ColumnUInt8 &>(col_res->getData()).getData(), col_res->getOffsets());
|
||||
Impl::vector(col->getChars(), col->getOffsets(),
|
||||
col_res->getChars(), col_res->getOffsets());
|
||||
}
|
||||
else if (const ColumnFixedString * col = dynamic_cast<const ColumnFixedString *>(&*column))
|
||||
{
|
||||
ColumnFixedString * col_res = new ColumnFixedString(col->getN());
|
||||
block.getByPosition(result).column = col_res;
|
||||
Impl::vector_fixed(dynamic_cast<const ColumnUInt8 &>(col->getData()).getData(), col->getN(),
|
||||
dynamic_cast<ColumnUInt8 &>(col_res->getData()).getData());
|
||||
Impl::vector_fixed(col->getChars(), col->getN(),
|
||||
col_res->getChars());
|
||||
}
|
||||
else if (const ColumnConstString * col = dynamic_cast<const ColumnConstString *>(&*column))
|
||||
{
|
||||
@ -984,21 +985,21 @@ public:
|
||||
{
|
||||
ColumnFixedString * c_res = new ColumnFixedString(c0_fixed_string->getN() + c1_fixed_string->getN());
|
||||
block.getByPosition(result).column = c_res;
|
||||
ColumnUInt8::Container_t & vec_res = dynamic_cast<ColumnUInt8 &>(c_res->getData()).getData();
|
||||
ColumnString::Chars_t & vec_res = c_res->getChars();
|
||||
|
||||
Impl::fixed_vector_fixed_vector(
|
||||
dynamic_cast<ColumnUInt8 &>(c0_fixed_string->getData()).getData(), c0_fixed_string->getN(),
|
||||
dynamic_cast<ColumnUInt8 &>(c1_fixed_string->getData()).getData(), c1_fixed_string->getN(),
|
||||
c0_fixed_string->getChars(), c0_fixed_string->getN(),
|
||||
c1_fixed_string->getChars(), c1_fixed_string->getN(),
|
||||
vec_res);
|
||||
}
|
||||
else if (c0_fixed_string && c1_const)
|
||||
{
|
||||
ColumnFixedString * c_res = new ColumnFixedString(c0_fixed_string->getN() + c1_const->getData().size());
|
||||
block.getByPosition(result).column = c_res;
|
||||
ColumnUInt8::Container_t & vec_res = dynamic_cast<ColumnUInt8 &>(c_res->getData()).getData();
|
||||
ColumnString::Chars_t & vec_res = c_res->getChars();
|
||||
|
||||
Impl::fixed_vector_constant(
|
||||
dynamic_cast<ColumnUInt8 &>(c0_fixed_string->getData()).getData(), c0_fixed_string->getN(),
|
||||
c0_fixed_string->getChars(), c0_fixed_string->getN(),
|
||||
c1_const->getData(),
|
||||
vec_res);
|
||||
}
|
||||
@ -1006,11 +1007,11 @@ public:
|
||||
{
|
||||
ColumnFixedString * c_res = new ColumnFixedString(c1_fixed_string->getN() + c0_const->getData().size());
|
||||
block.getByPosition(result).column = c_res;
|
||||
ColumnUInt8::Container_t & vec_res = dynamic_cast<ColumnUInt8 &>(c_res->getData()).getData();
|
||||
ColumnString::Chars_t & vec_res = c_res->getChars();
|
||||
|
||||
Impl::constant_fixed_vector(
|
||||
c0_const->getData(),
|
||||
dynamic_cast<ColumnUInt8 &>(c1_fixed_string->getData()).getData(), c1_fixed_string->getN(),
|
||||
c1_fixed_string->getChars(), c1_fixed_string->getN(),
|
||||
vec_res);
|
||||
}
|
||||
}
|
||||
@ -1018,33 +1019,33 @@ public:
|
||||
{
|
||||
ColumnString * c_res = new ColumnString;
|
||||
block.getByPosition(result).column = c_res;
|
||||
ColumnUInt8::Container_t & vec_res = dynamic_cast<ColumnUInt8 &>(c_res->getData()).getData();
|
||||
ColumnString::Chars_t & vec_res = c_res->getChars();
|
||||
ColumnString::Offsets_t & offsets_res = c_res->getOffsets();
|
||||
|
||||
if (c0_string && c1_string)
|
||||
Impl::vector_vector(
|
||||
dynamic_cast<ColumnUInt8 &>(c0_string->getData()).getData(), c0_string->getOffsets(),
|
||||
dynamic_cast<ColumnUInt8 &>(c1_string->getData()).getData(), c1_string->getOffsets(),
|
||||
c0_string->getChars(), c0_string->getOffsets(),
|
||||
c1_string->getChars(), c1_string->getOffsets(),
|
||||
vec_res, offsets_res);
|
||||
else if (c0_string && c1_fixed_string)
|
||||
Impl::vector_fixed_vector(
|
||||
dynamic_cast<ColumnUInt8 &>(c0_string->getData()).getData(), c0_string->getOffsets(),
|
||||
dynamic_cast<ColumnUInt8 &>(c1_fixed_string->getData()).getData(), c1_fixed_string->getN(),
|
||||
c0_string->getChars(), c0_string->getOffsets(),
|
||||
c1_fixed_string->getChars(), c1_fixed_string->getN(),
|
||||
vec_res, offsets_res);
|
||||
else if (c0_string && c1_const)
|
||||
Impl::vector_constant(
|
||||
dynamic_cast<ColumnUInt8 &>(c0_string->getData()).getData(), c0_string->getOffsets(),
|
||||
c0_string->getChars(), c0_string->getOffsets(),
|
||||
c1_const->getData(),
|
||||
vec_res, offsets_res);
|
||||
else if (c0_fixed_string && c1_string)
|
||||
Impl::fixed_vector_vector(
|
||||
dynamic_cast<ColumnUInt8 &>(c0_fixed_string->getData()).getData(), c0_fixed_string->getN(),
|
||||
dynamic_cast<ColumnUInt8 &>(c1_string->getData()).getData(), c1_string->getOffsets(),
|
||||
c0_fixed_string->getChars(), c0_fixed_string->getN(),
|
||||
c1_string->getChars(), c1_string->getOffsets(),
|
||||
vec_res, offsets_res);
|
||||
else if (c0_const && c1_string)
|
||||
Impl::constant_vector(
|
||||
c0_const->getData(),
|
||||
dynamic_cast<ColumnUInt8 &>(c1_string->getData()).getData(), c1_string->getOffsets(),
|
||||
c1_string->getChars(), c1_string->getOffsets(),
|
||||
vec_res, offsets_res);
|
||||
else
|
||||
throw Exception("Illegal columns "
|
||||
@ -1110,17 +1111,17 @@ public:
|
||||
{
|
||||
ColumnString * col_res = new ColumnString;
|
||||
block.getByPosition(result).column = col_res;
|
||||
Impl::vector(dynamic_cast<const ColumnUInt8 &>(col->getData()).getData(), col->getOffsets(),
|
||||
Impl::vector(col->getChars(), col->getOffsets(),
|
||||
start, length,
|
||||
dynamic_cast<ColumnUInt8 &>(col_res->getData()).getData(), col_res->getOffsets());
|
||||
col_res->getChars(), col_res->getOffsets());
|
||||
}
|
||||
else if (const ColumnFixedString * col = dynamic_cast<const ColumnFixedString *>(&*column_string))
|
||||
{
|
||||
ColumnFixedString * col_res = new ColumnFixedString(length);
|
||||
block.getByPosition(result).column = col_res;
|
||||
Impl::vector_fixed(dynamic_cast<const ColumnUInt8 &>(col->getData()).getData(), col->getN(),
|
||||
Impl::vector_fixed(col->getChars(), col->getN(),
|
||||
start, length,
|
||||
dynamic_cast<ColumnUInt8 &>(col_res->getData()).getData());
|
||||
col_res->getChars());
|
||||
}
|
||||
else if (const ColumnConstString * col = dynamic_cast<const ColumnConstString *>(&*column_string))
|
||||
{
|
||||
|
@ -245,12 +245,12 @@ public:
|
||||
ColumnArray * col_res = new ColumnArray(new ColumnString);
|
||||
ColumnString & res_strings = dynamic_cast<ColumnString &>(col_res->getData());
|
||||
ColumnArray::Offsets_t & res_offsets = col_res->getOffsets();
|
||||
ColumnUInt8::Container_t & res_strings_chars = dynamic_cast<ColumnUInt8 &>(res_strings.getData()).getData();
|
||||
ColumnString::Chars_t & res_strings_chars = res_strings.getChars();
|
||||
ColumnString::Offsets_t & res_strings_offsets = res_strings.getOffsets();
|
||||
|
||||
if (col_str)
|
||||
{
|
||||
const ColumnUInt8::Container_t & src_chars = dynamic_cast<const ColumnUInt8 &>(col_str->getData()).getData();
|
||||
const ColumnString::Chars_t & src_chars = col_str->getChars();
|
||||
const ColumnString::Offsets_t & src_offsets = col_str->getOffsets();
|
||||
|
||||
res_offsets.reserve(src_offsets.size());
|
||||
|
@ -42,7 +42,7 @@ struct PositionImpl
|
||||
typedef UInt64 ResultType;
|
||||
|
||||
/// Предполагается, что res нужного размера и инициализирован нулями.
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnArray::Offsets_t & offsets,
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnString::Offsets_t & offsets,
|
||||
const std::string & needle,
|
||||
std::vector<UInt64> & res)
|
||||
{
|
||||
@ -84,7 +84,7 @@ struct PositionUTF8Impl
|
||||
{
|
||||
typedef UInt64 ResultType;
|
||||
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnArray::Offsets_t & offsets,
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnString::Offsets_t & offsets,
|
||||
const std::string & needle,
|
||||
std::vector<UInt64> & res)
|
||||
{
|
||||
@ -261,7 +261,7 @@ struct MatchImpl
|
||||
{
|
||||
typedef UInt8 ResultType;
|
||||
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnArray::Offsets_t & offsets,
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnString::Offsets_t & offsets,
|
||||
const std::string & pattern,
|
||||
std::vector<UInt8> & res)
|
||||
{
|
||||
@ -315,9 +315,9 @@ struct MatchImpl
|
||||
|
||||
struct ExtractImpl
|
||||
{
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnArray::Offsets_t & offsets,
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnString::Offsets_t & offsets,
|
||||
const std::string & pattern,
|
||||
std::vector<UInt8> & res_data, ColumnArray::Offsets_t & res_offsets)
|
||||
std::vector<UInt8> & res_data, ColumnString::Offsets_t & res_offsets)
|
||||
{
|
||||
res_data.reserve(data.size() / 5);
|
||||
res_offsets.resize(offsets.size());
|
||||
@ -405,7 +405,7 @@ public:
|
||||
|
||||
typename ColumnVector<ResultType>::Container_t & vec_res = col_res->getData();
|
||||
vec_res.resize(col->size());
|
||||
Impl::vector(dynamic_cast<const ColumnUInt8 &>(col->getData()).getData(), col->getOffsets(), col_needle->getData(), vec_res);
|
||||
Impl::vector(col->getChars(), col->getOffsets(), col_needle->getData(), vec_res);
|
||||
}
|
||||
else if (const ColumnConstString * col = dynamic_cast<const ColumnConstString *>(&*column))
|
||||
{
|
||||
@ -467,17 +467,17 @@ public:
|
||||
ColumnString * col_res = new ColumnString;
|
||||
block.getByPosition(result).column = col_res;
|
||||
|
||||
ColumnUInt8::Container_t & vec_res = dynamic_cast<ColumnUInt8 &>(col_res->getData()).getData();
|
||||
ColumnString::Chars_t & vec_res = col_res->getChars();
|
||||
ColumnString::Offsets_t & offsets_res = col_res->getOffsets();
|
||||
Impl::vector(dynamic_cast<const ColumnUInt8 &>(col->getData()).getData(), col->getOffsets(), col_needle->getData(), vec_res, offsets_res);
|
||||
Impl::vector(col->getChars(), col->getOffsets(), col_needle->getData(), vec_res, offsets_res);
|
||||
}
|
||||
else if (const ColumnConstString * col = dynamic_cast<const ColumnConstString *>(&*column))
|
||||
{
|
||||
const std::string & data = col->getData();
|
||||
std::vector<UInt8> vdata(data.c_str(), data.c_str() + data.size() + 1);
|
||||
ColumnArray::Offsets_t offsets(1, vdata.size());
|
||||
ColumnString::Offsets_t offsets(1, vdata.size());
|
||||
std::vector<UInt8> res_vdata;
|
||||
ColumnArray::Offsets_t res_offsets;
|
||||
ColumnString::Offsets_t res_offsets;
|
||||
Impl::vector(vdata, offsets, col_needle->getData(), res_vdata, res_offsets);
|
||||
|
||||
std::string res = std::string(res_vdata.begin(), res_vdata.end() - 1);
|
||||
|
@ -270,9 +270,9 @@ struct ExtractWWW
|
||||
struct ExtractURLParameterImpl
|
||||
{
|
||||
static void vector(const std::vector<UInt8> & data,
|
||||
const ColumnArray::Offsets_t & offsets,
|
||||
const ColumnString::Offsets_t & offsets,
|
||||
std::string pattern,
|
||||
std::vector<UInt8> & res_data, ColumnArray::Offsets_t & res_offsets)
|
||||
std::vector<UInt8> & res_data, ColumnString::Offsets_t & res_offsets)
|
||||
{
|
||||
res_data.reserve(data.size() / 5);
|
||||
res_offsets.resize(offsets.size());
|
||||
@ -338,9 +338,9 @@ struct ExtractURLParameterImpl
|
||||
struct CutURLParameterImpl
|
||||
{
|
||||
static void vector(const std::vector<UInt8> & data,
|
||||
const ColumnArray::Offsets_t & offsets,
|
||||
const ColumnString::Offsets_t & offsets,
|
||||
std::string pattern,
|
||||
std::vector<UInt8> & res_data, ColumnArray::Offsets_t & res_offsets)
|
||||
std::vector<UInt8> & res_data, ColumnString::Offsets_t & res_offsets)
|
||||
{
|
||||
res_data.reserve(data.size());
|
||||
res_offsets.resize(offsets.size());
|
||||
@ -563,8 +563,8 @@ public:
|
||||
template <typename Extractor>
|
||||
struct ExtractSubstringImpl
|
||||
{
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnArray::Offsets_t & offsets,
|
||||
std::vector<UInt8> & res_data, ColumnArray::Offsets_t & res_offsets)
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnString::Offsets_t & offsets,
|
||||
std::vector<UInt8> & res_data, ColumnString::Offsets_t & res_offsets)
|
||||
{
|
||||
size_t size = offsets.size();
|
||||
res_offsets.resize(size);
|
||||
@ -613,8 +613,8 @@ struct ExtractSubstringImpl
|
||||
template <typename Extractor>
|
||||
struct CutSubstringImpl
|
||||
{
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnArray::Offsets_t & offsets,
|
||||
std::vector<UInt8> & res_data, ColumnArray::Offsets_t & res_offsets)
|
||||
static void vector(const std::vector<UInt8> & data, const ColumnString::Offsets_t & offsets,
|
||||
std::vector<UInt8> & res_data, ColumnString::Offsets_t & res_offsets)
|
||||
{
|
||||
res_data.reserve(data.size());
|
||||
size_t size = offsets.size();
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <DB/Columns/ColumnString.h>
|
||||
#include <DB/Columns/ColumnConst.h>
|
||||
#include <DB/Columns/ColumnArray.h>
|
||||
#include <DB/Columns/ColumnFixedString.h>
|
||||
|
||||
|
||||
@ -17,7 +18,7 @@ template <> ColumnPtr ColumnConst<String>::convertToFullColumn() const
|
||||
ColumnString * res = new ColumnString;
|
||||
ColumnPtr res_ptr = res;
|
||||
ColumnString::Offsets_t & offsets = res->getOffsets();
|
||||
ColumnUInt8::Container_t & vec = dynamic_cast<ColumnVector<UInt8> &>(res->getData()).getData();
|
||||
ColumnString::Chars_t & vec = res->getChars();
|
||||
|
||||
size_t string_size = data.size() + 1;
|
||||
size_t offset = 0;
|
||||
@ -42,7 +43,7 @@ template <> ColumnPtr ColumnConst<String>::convertToFullColumn() const
|
||||
|
||||
ColumnFixedString * res = new ColumnFixedString(n);
|
||||
ColumnPtr res_ptr = res;
|
||||
ColumnUInt8::Container_t & vec = dynamic_cast<ColumnVector<UInt8> &>(res->getData()).getData();
|
||||
ColumnFixedString::Chars_t & vec = res->getChars();
|
||||
|
||||
vec.resize(n * s, 0);
|
||||
size_t offset = 0;
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <Poco/SharedPtr.h>
|
||||
|
||||
#include <DB/Columns/ColumnFixedArray.h>
|
||||
#include <DB/Columns/ColumnFixedString.h>
|
||||
#include <DB/Columns/ColumnsNumber.h>
|
||||
#include <DB/Columns/ColumnConst.h>
|
||||
@ -40,8 +39,7 @@ void DataTypeFixedString::deserializeBinary(Field & field, ReadBuffer & istr) co
|
||||
|
||||
void DataTypeFixedString::serializeBinary(const IColumn & column, WriteBuffer & ostr, size_t offset, size_t limit) const
|
||||
{
|
||||
const ColumnFixedArray & column_array = dynamic_cast<const ColumnFixedArray &>(column);
|
||||
const ColumnUInt8::Container_t & data = dynamic_cast<const ColumnUInt8 &>(column_array.getData()).getData();
|
||||
const ColumnFixedString::Chars_t & data = dynamic_cast<const ColumnFixedString &>(column).getChars();
|
||||
|
||||
size_t size = data.size() / n;
|
||||
|
||||
@ -54,8 +52,7 @@ void DataTypeFixedString::serializeBinary(const IColumn & column, WriteBuffer &
|
||||
|
||||
void DataTypeFixedString::deserializeBinary(IColumn & column, ReadBuffer & istr, size_t limit) const
|
||||
{
|
||||
ColumnFixedArray & column_array = dynamic_cast<ColumnFixedArray &>(column);
|
||||
ColumnUInt8::Container_t & data = dynamic_cast<ColumnUInt8 &>(column_array.getData()).getData();
|
||||
ColumnFixedString::Chars_t & data = dynamic_cast<ColumnFixedString &>(column).getChars();
|
||||
|
||||
size_t max_bytes = limit * n;
|
||||
data.resize(max_bytes);
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include <DB/Core/Defines.h>
|
||||
|
||||
#include <DB/Columns/ColumnArray.h>
|
||||
#include <DB/Columns/ColumnString.h>
|
||||
#include <DB/Columns/ColumnsNumber.h>
|
||||
#include <DB/Columns/ColumnConst.h>
|
||||
@ -42,13 +41,12 @@ void DataTypeString::deserializeBinary(Field & field, ReadBuffer & istr) const
|
||||
|
||||
void DataTypeString::serializeBinary(const IColumn & column, WriteBuffer & ostr, size_t offset, size_t limit) const
|
||||
{
|
||||
const ColumnArray & column_array = dynamic_cast<const ColumnArray &>(column);
|
||||
const ColumnUInt8::Container_t & data = dynamic_cast<const ColumnUInt8 &>(column_array.getData()).getData();
|
||||
const ColumnArray::Offsets_t & offsets = column_array.getOffsets();
|
||||
const ColumnString & column_string = dynamic_cast<const ColumnString &>(column);
|
||||
const ColumnString::Chars_t & data = column_string.getChars();
|
||||
const ColumnString::Offsets_t & offsets = column_string.getOffsets();
|
||||
|
||||
size_t array_size = column_array.size();
|
||||
size_t size = column.size();
|
||||
if (!array_size)
|
||||
if (!size)
|
||||
return;
|
||||
|
||||
size_t end = limit && offset + limit < size
|
||||
@ -75,9 +73,9 @@ void DataTypeString::serializeBinary(const IColumn & column, WriteBuffer & ostr,
|
||||
|
||||
void DataTypeString::deserializeBinary(IColumn & column, ReadBuffer & istr, size_t limit) const
|
||||
{
|
||||
ColumnArray & column_array = dynamic_cast<ColumnArray &>(column);
|
||||
ColumnUInt8::Container_t & data = dynamic_cast<ColumnUInt8 &>(column_array.getData()).getData();
|
||||
ColumnArray::Offsets_t & offsets = column_array.getOffsets();
|
||||
ColumnString & column_string = dynamic_cast<ColumnString &>(column);
|
||||
ColumnString::Chars_t & data = column_string.getChars();
|
||||
ColumnString::Offsets_t & offsets = column_string.getOffsets();
|
||||
|
||||
data.reserve(limit * DBMS_APPROX_STRING_SIZE);
|
||||
offsets.reserve(limit);
|
||||
|
@ -24,8 +24,8 @@ int main(int argc, char ** argv)
|
||||
|
||||
{
|
||||
Poco::SharedPtr<DB::ColumnString> column = new DB::ColumnString();
|
||||
DB::ColumnUInt8::Container_t & data = dynamic_cast<DB::ColumnUInt8 &>(column->getData()).getData();
|
||||
DB::ColumnArray::Offsets_t & offsets = column->getOffsets();
|
||||
DB::ColumnString::Chars_t & data = column->getChars();
|
||||
DB::ColumnString::Offsets_t & offsets = column->getOffsets();
|
||||
|
||||
data.resize(n * size);
|
||||
offsets.resize(n);
|
||||
|
@ -50,14 +50,14 @@ FunctionPtr FunctionFactory::get(
|
||||
else if (name == "less") return new FunctionLess;
|
||||
else if (name == "greater") return new FunctionGreater;
|
||||
else if (name == "lessOrEquals") return new FunctionLessOrEquals;
|
||||
else if (name == "greaterOrEquals") return new FunctionGreaterOrEquals;
|
||||
else if (name == "greaterOrEquals") return new FunctionGreaterOrEquals;
|
||||
|
||||
else if (name == "and") return new FunctionAnd;
|
||||
else if (name == "or") return new FunctionOr;
|
||||
else if (name == "xor") return new FunctionXor;
|
||||
else if (name == "not") return new FunctionNot;
|
||||
|
||||
else if (name == "roundToExp2") return new FunctionRoundToExp2;
|
||||
else if (name == "roundToExp2") return new FunctionRoundToExp2;
|
||||
else if (name == "roundDuration") return new FunctionRoundDuration;
|
||||
else if (name == "roundAge") return new FunctionRoundAge;
|
||||
|
||||
@ -70,7 +70,7 @@ FunctionPtr FunctionFactory::get(
|
||||
else if (name == "lowerUTF8") return new FunctionLowerUTF8;
|
||||
else if (name == "upperUTF8") return new FunctionUpperUTF8;
|
||||
else if (name == "reverse") return new FunctionReverse;
|
||||
else if (name == "reverseUTF8") return new FunctionReverseUTF8;
|
||||
else if (name == "reverseUTF8") return new FunctionReverseUTF8;
|
||||
else if (name == "concat") return new FunctionConcat;
|
||||
else if (name == "substring") return new FunctionSubstring;
|
||||
else if (name == "substringUTF8") return new FunctionSubstringUTF8;
|
||||
@ -92,9 +92,9 @@ FunctionPtr FunctionFactory::get(
|
||||
else if (name == "toString") return new FunctionToString;
|
||||
|
||||
else if (name == "reinterpretAsUInt8") return new FunctionReinterpretAsUInt8;
|
||||
else if (name == "reinterpretAsUInt16") return new FunctionReinterpretAsUInt16;
|
||||
else if (name == "reinterpretAsUInt32") return new FunctionReinterpretAsUInt32;
|
||||
else if (name == "reinterpretAsUInt64") return new FunctionReinterpretAsUInt64;
|
||||
else if (name == "reinterpretAsUInt16") return new FunctionReinterpretAsUInt16;
|
||||
else if (name == "reinterpretAsUInt32") return new FunctionReinterpretAsUInt32;
|
||||
else if (name == "reinterpretAsUInt64") return new FunctionReinterpretAsUInt64;
|
||||
else if (name == "reinterpretAsInt8") return new FunctionReinterpretAsInt8;
|
||||
else if (name == "reinterpretAsInt16") return new FunctionReinterpretAsInt16;
|
||||
else if (name == "reinterpretAsInt32") return new FunctionReinterpretAsInt32;
|
||||
@ -103,19 +103,19 @@ FunctionPtr FunctionFactory::get(
|
||||
else if (name == "reinterpretAsFloat64") return new FunctionReinterpretAsFloat64;
|
||||
else if (name == "reinterpretAsDate") return new FunctionReinterpretAsDate;
|
||||
else if (name == "reinterpretAsDateTime") return new FunctionReinterpretAsDateTime;
|
||||
else if (name == "reinterpretAsString") return new FunctionReinterpretAsString;
|
||||
else if (name == "reinterpretAsString") return new FunctionReinterpretAsString;
|
||||
|
||||
else if (name == "toYear") return new FunctionToYear;
|
||||
else if (name == "toMonth") return new FunctionToMonth;
|
||||
else if (name == "toDayOfMonth") return new FunctionToDayOfMonth;
|
||||
else if (name == "toDayOfWeek") return new FunctionToDayOfWeek;
|
||||
else if (name == "toDayOfWeek") return new FunctionToDayOfWeek;
|
||||
else if (name == "toHour") return new FunctionToHour;
|
||||
else if (name == "toMinute") return new FunctionToMinute;
|
||||
else if (name == "toSecond") return new FunctionToSecond;
|
||||
else if (name == "toMonday") return new FunctionToMonday;
|
||||
else if (name == "toStartOfMonth") return new FunctionToStartOfMonth;
|
||||
else if (name == "toStartOfYear") return new FunctionToStartOfYear;
|
||||
else if (name == "toStartOfMinute") return new FunctionToStartOfMinute;
|
||||
else if (name == "toStartOfMinute") return new FunctionToStartOfMinute;
|
||||
else if (name == "toStartOfHour") return new FunctionToStartOfHour;
|
||||
else if (name == "toTime") return new FunctionToTime;
|
||||
else if (name == "now") return new FunctionNow;
|
||||
@ -133,8 +133,8 @@ FunctionPtr FunctionFactory::get(
|
||||
else if (name == "cityHash64") return new FunctionCityHash64;
|
||||
else if (name == "intHash32") return new FunctionIntHash32;
|
||||
|
||||
else if (name == "IPv4NumToString") return new FunctionIPv4NumToString;
|
||||
else if (name == "IPv4StringToNum") return new FunctionIPv4StringToNum;
|
||||
else if (name == "IPv4NumToString") return new FunctionIPv4NumToString;
|
||||
else if (name == "IPv4StringToNum") return new FunctionIPv4StringToNum;
|
||||
else if (name == "hex") return new FunctionHex;
|
||||
else if (name == "unhex") return new FunctionUnhex;
|
||||
|
||||
@ -146,23 +146,23 @@ FunctionPtr FunctionFactory::get(
|
||||
else if (name == "domainWithoutWWW") return new FunctionDomainWithoutWWW;
|
||||
else if (name == "topLevelDomain") return new FunctionTopLevelDomain;
|
||||
else if (name == "path") return new FunctionPath;
|
||||
else if (name == "queryString") return new FunctionQueryString;
|
||||
else if (name == "queryString") return new FunctionQueryString;
|
||||
else if (name == "fragment") return new FunctionFragment;
|
||||
else if (name == "queryStringAndFragment") return new FunctionQueryStringAndFragment;
|
||||
else if (name == "cutWWW") return new FunctionCutWWW;
|
||||
else if (name == "cutQueryString") return new FunctionCutQueryString;
|
||||
else if (name == "cutFragment") return new FunctionCutFragment;
|
||||
else if (name == "cutFragment") return new FunctionCutFragment;
|
||||
else if (name == "cutQueryStringAndFragment") return new FunctionCutQueryStringAndFragment;
|
||||
else if (name == "extractURLParameter") return new FunctionExtractURLParameter;
|
||||
else if (name == "extractURLParameter") return new FunctionExtractURLParameter;
|
||||
else if (name == "extractURLParameters") return new FunctionExtractURLParameters;
|
||||
else if (name == "cutURLParameter") return new FunctionCutURLParameter;
|
||||
else if (name == "cutURLParameter") return new FunctionCutURLParameter;
|
||||
else if (name == "URLHierarchy") return new FunctionURLHierarchy;
|
||||
|
||||
else if (name == "visibleWidth") return new FunctionVisibleWidth;
|
||||
else if (name == "toTypeName") return new FunctionToTypeName;
|
||||
else if (name == "blockSize") return new FunctionBlockSize;
|
||||
else if (name == "sleep") return new FunctionSleep;
|
||||
else if (name == "materialize") return new FunctionMaterialize;
|
||||
else if (name == "materialize") return new FunctionMaterialize;
|
||||
else if (name == "ignore") return new FunctionIgnore;
|
||||
else if (name == "arrayJoin") return new FunctionArrayJoin;
|
||||
|
||||
@ -177,15 +177,15 @@ FunctionPtr FunctionFactory::get(
|
||||
else if (name == "indexOf") return new FunctionIndexOf;
|
||||
else if (name == "countEqual") return new FunctionCountEqual;
|
||||
|
||||
else if (name == "alphaTokens") return new FunctionAlphaTokens;
|
||||
else if (name == "splitByChar") return new FunctionSplitByChar;
|
||||
else if (name == "alphaTokens") return new FunctionAlphaTokens;
|
||||
else if (name == "splitByChar") return new FunctionSplitByChar;
|
||||
else if (name == "splitByString") return new FunctionSplitByString;
|
||||
|
||||
else if (name == "if") return new FunctionIf;
|
||||
|
||||
else if (name == "regionToCity") return new FunctionRegionToCity(context.getDictionaries().getRegionsHierarchy());
|
||||
else if (name == "regionToArea") return new FunctionRegionToArea(context.getDictionaries().getRegionsHierarchy());
|
||||
else if (name == "regionToCountry") return new FunctionRegionToCountry(context.getDictionaries().getRegionsHierarchy());
|
||||
else if (name == "regionToCountry") return new FunctionRegionToCountry(context.getDictionaries().getRegionsHierarchy());
|
||||
else if (name == "OSToRoot") return new FunctionOSToRoot(context.getDictionaries().getTechDataHierarchy());
|
||||
else if (name == "SEToRoot") return new FunctionSEToRoot(context.getDictionaries().getTechDataHierarchy());
|
||||
else if (name == "categoryToRoot") return new FunctionCategoryToRoot(context.getDictionaries().getCategoriesHierarchy());
|
||||
@ -194,9 +194,9 @@ FunctionPtr FunctionFactory::get(
|
||||
else if (name == "OSIn") return new FunctionOSIn(context.getDictionaries().getTechDataHierarchy());
|
||||
else if (name == "SEIn") return new FunctionSEIn(context.getDictionaries().getTechDataHierarchy());
|
||||
else if (name == "categoryIn") return new FunctionCategoryIn(context.getDictionaries().getCategoriesHierarchy());
|
||||
else if (name == "regionHierarchy") return new FunctionRegionHierarchy(context.getDictionaries().getRegionsHierarchy());
|
||||
else if (name == "OSHierarchy") return new FunctionOSHierarchy(context.getDictionaries().getTechDataHierarchy());
|
||||
else if (name == "SEHierarchy") return new FunctionSEHierarchy(context.getDictionaries().getTechDataHierarchy());
|
||||
else if (name == "regionHierarchy") return new FunctionRegionHierarchy(context.getDictionaries().getRegionsHierarchy());
|
||||
else if (name == "OSHierarchy") return new FunctionOSHierarchy(context.getDictionaries().getTechDataHierarchy());
|
||||
else if (name == "SEHierarchy") return new FunctionSEHierarchy(context.getDictionaries().getTechDataHierarchy());
|
||||
else if (name == "categoryHierarchy") return new FunctionCategoryHierarchy(context.getDictionaries().getCategoriesHierarchy());
|
||||
|
||||
else
|
||||
|
@ -290,7 +290,7 @@ void Aggregator::execute(BlockInputStreamPtr stream, AggregatedDataVariants & re
|
||||
if (const ColumnString * column_string = dynamic_cast<const ColumnString *>(&column))
|
||||
{
|
||||
const ColumnString::Offsets_t & offsets = column_string->getOffsets();
|
||||
const ColumnUInt8::Container_t & data = dynamic_cast<const ColumnUInt8 &>(column_string->getData()).getData();
|
||||
const ColumnString::Chars_t & data = column_string->getChars();
|
||||
|
||||
/// Для всех строчек
|
||||
for (size_t i = 0; i < rows; ++i)
|
||||
@ -333,7 +333,7 @@ void Aggregator::execute(BlockInputStreamPtr stream, AggregatedDataVariants & re
|
||||
else if (const ColumnFixedString * column_string = dynamic_cast<const ColumnFixedString *>(&column))
|
||||
{
|
||||
size_t n = column_string->getN();
|
||||
const ColumnUInt8::Container_t & data = dynamic_cast<const ColumnUInt8 &>(column_string->getData()).getData();
|
||||
const ColumnFixedString::Chars_t & data = column_string->getChars();
|
||||
|
||||
/// Для всех строчек
|
||||
for (size_t i = 0; i < rows; ++i)
|
||||
@ -861,7 +861,7 @@ void Aggregator::merge(BlockInputStreamPtr stream, AggregatedDataVariants & resu
|
||||
if (const ColumnString * column_string = dynamic_cast<const ColumnString *>(&column))
|
||||
{
|
||||
const ColumnString::Offsets_t & offsets = column_string->getOffsets();
|
||||
const ColumnUInt8::Container_t & data = dynamic_cast<const ColumnUInt8 &>(column_string->getData()).getData();
|
||||
const ColumnString::Chars_t & data = column_string->getChars();
|
||||
|
||||
/// Для всех строчек
|
||||
for (size_t i = with_totals ? 1 : 0; i < rows; ++i)
|
||||
@ -890,7 +890,7 @@ void Aggregator::merge(BlockInputStreamPtr stream, AggregatedDataVariants & resu
|
||||
else if (const ColumnFixedString * column_string = dynamic_cast<const ColumnFixedString *>(&column))
|
||||
{
|
||||
size_t n = column_string->getN();
|
||||
const ColumnUInt8::Container_t & data = dynamic_cast<const ColumnUInt8 &>(column_string->getData()).getData();
|
||||
const ColumnFixedString::Chars_t & data = column_string->getChars();
|
||||
|
||||
/// Для всех строчек
|
||||
for (size_t i = with_totals ? 1 : 0; i < rows; ++i)
|
||||
|
@ -108,7 +108,7 @@ void Set::create(BlockInputStreamPtr stream)
|
||||
if (const ColumnString * column_string = dynamic_cast<const ColumnString *>(&column))
|
||||
{
|
||||
const ColumnString::Offsets_t & offsets = column_string->getOffsets();
|
||||
const ColumnUInt8::Container_t & data = dynamic_cast<const ColumnUInt8 &>(column_string->getData()).getData();
|
||||
const ColumnString::Chars_t & data = column_string->getChars();
|
||||
|
||||
/// Для всех строчек
|
||||
for (size_t i = 0; i < rows; ++i)
|
||||
@ -127,7 +127,7 @@ void Set::create(BlockInputStreamPtr stream)
|
||||
else if (const ColumnFixedString * column_string = dynamic_cast<const ColumnFixedString *>(&column))
|
||||
{
|
||||
size_t n = column_string->getN();
|
||||
const ColumnUInt8::Container_t & data = dynamic_cast<const ColumnUInt8 &>(column_string->getData()).getData();
|
||||
const ColumnFixedString::Chars_t & data = column_string->getChars();
|
||||
|
||||
/// Для всех строчек
|
||||
for (size_t i = 0; i < rows; ++i)
|
||||
@ -337,7 +337,7 @@ void Set::executeOrdinary(const ConstColumnPlainPtrs & key_columns, ColumnUInt8:
|
||||
if (const ColumnString * column_string = dynamic_cast<const ColumnString *>(&column))
|
||||
{
|
||||
const ColumnString::Offsets_t & offsets = column_string->getOffsets();
|
||||
const ColumnUInt8::Container_t & data = dynamic_cast<const ColumnUInt8 &>(column_string->getData()).getData();
|
||||
const ColumnString::Chars_t & data = column_string->getChars();
|
||||
|
||||
/// Для всех строчек
|
||||
for (size_t i = 0; i < rows; ++i)
|
||||
@ -350,7 +350,7 @@ void Set::executeOrdinary(const ConstColumnPlainPtrs & key_columns, ColumnUInt8:
|
||||
else if (const ColumnFixedString * column_string = dynamic_cast<const ColumnFixedString *>(&column))
|
||||
{
|
||||
size_t n = column_string->getN();
|
||||
const ColumnUInt8::Container_t & data = dynamic_cast<const ColumnUInt8 &>(column_string->getData()).getData();
|
||||
const ColumnFixedString::Chars_t & data = column_string->getChars();
|
||||
|
||||
/// Для всех строчек
|
||||
for (size_t i = 0; i < rows; ++i)
|
||||
@ -433,7 +433,7 @@ void Set::executeArray(const ColumnArray * key_column, ColumnUInt8::Container_t
|
||||
if (const ColumnString * column_string = dynamic_cast<const ColumnString *>(&nested_column))
|
||||
{
|
||||
const ColumnString::Offsets_t & nested_offsets = column_string->getOffsets();
|
||||
const ColumnUInt8::Container_t & data = dynamic_cast<const ColumnUInt8 &>(column_string->getData()).getData();
|
||||
const ColumnString::Chars_t & data = column_string->getChars();
|
||||
|
||||
size_t prev_offset = 0;
|
||||
/// Для всех строчек
|
||||
@ -458,7 +458,7 @@ void Set::executeArray(const ColumnArray * key_column, ColumnUInt8::Container_t
|
||||
else if (const ColumnFixedString * column_string = dynamic_cast<const ColumnFixedString *>(&nested_column))
|
||||
{
|
||||
size_t n = column_string->getN();
|
||||
const ColumnUInt8::Container_t & data = dynamic_cast<const ColumnUInt8 &>(column_string->getData()).getData();
|
||||
const ColumnFixedString::Chars_t & data = column_string->getChars();
|
||||
|
||||
size_t prev_offset = 0;
|
||||
/// Для всех строчек
|
||||
|
Loading…
Reference in New Issue
Block a user