mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-12 02:23:14 +00:00
8b3afeb60d
commit f968e7e7f0d84c89fd26dea1d541bd9f6041d7c8 Author: Alexey Milovidov <milovidov@yandex-team.ru> Date: Tue Feb 16 06:11:29 2016 +0300 Addition [#METR-2944]. commit 7524981fa7c4f22929dd5009444a0ae28500f620 Author: Alexey Milovidov <milovidov@yandex-team.ru> Date: Tue Feb 16 06:08:43 2016 +0300 Fixed error (incomplete) [#METR-2944]. commit 2f1e7bf9f46cd9ce958ade9041c00ce067940fd2 Author: Alexey Milovidov <milovidov@yandex-team.ru> Date: Tue Feb 16 05:37:43 2016 +0300 Improving performance of row formats [#METR-2944]. commit 9848910f235863c9571ef1ebe0d87d4929ee283c Author: Alexey Milovidov <milovidov@yandex-team.ru> Date: Tue Feb 16 00:37:12 2016 +0300 Improving performance of text formats [#METR-2944]. commit 3aedc7fd784af962e64ffdd10ec23ac53827d8e2 Author: Alexey Milovidov <milovidov@yandex-team.ru> Date: Tue Feb 16 00:18:00 2016 +0300 Improving performance of row formats [#METR-2944]. commit cb5932c2b0385604477e69c8262dc31a4bb4b23b Author: Alexey Milovidov <milovidov@yandex-team.ru> Date: Mon Feb 15 00:53:27 2016 +0300 Fixed error. commit 42863fd4eddeef594e846c598b92877b6ff86fa6 Author: Alexey Milovidov <milovidov@yandex-team.ru> Date: Sun Feb 14 23:13:46 2016 +0300 Improving performance of row formats [#METR-2944]. commit 71c6fb19a85a79297433ceb486fdb97e551d964f Author: Alexey Milovidov <milovidov@yandex-team.ru> Date: Sun Feb 14 16:58:56 2016 +0300 Improving performance of row formats [#METR-2944].
94 lines
3.2 KiB
C++
94 lines
3.2 KiB
C++
#pragma once
|
||
|
||
#include <DB/Columns/IColumn.h>
|
||
#include <DB/Columns/ColumnsCommon.h>
|
||
|
||
|
||
namespace DB
|
||
{
|
||
|
||
namespace ErrorCodes
|
||
{
|
||
extern const int SIZES_OF_COLUMNS_DOESNT_MATCH;
|
||
extern const int NOT_IMPLEMENTED;
|
||
}
|
||
|
||
|
||
/** Базовый класс для столбцов-констант, содержащих значение, не входящее в Field.
|
||
* Не является полноценым столбцом и используется особым образом.
|
||
*/
|
||
class IColumnDummy : public IColumn
|
||
{
|
||
public:
|
||
IColumnDummy(size_t s_) : s(s_) {}
|
||
|
||
virtual ColumnPtr cloneDummy(size_t s_) const = 0;
|
||
|
||
ColumnPtr cloneResized(size_t s_) const override { return cloneDummy(s_); }
|
||
bool isConst() const override { return true; }
|
||
size_t size() const override { return s; }
|
||
void insertDefault() override { ++s; }
|
||
void popBack(size_t n) override { s -= n; }
|
||
size_t byteSize() const override { return 0; }
|
||
int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const override { return 0; }
|
||
|
||
Field operator[](size_t n) const override { throw Exception("Cannot get value from " + getName(), ErrorCodes::NOT_IMPLEMENTED); }
|
||
void get(size_t n, Field & res) const override { throw Exception("Cannot get value from " + getName(), ErrorCodes::NOT_IMPLEMENTED); };
|
||
void insert(const Field & x) override { throw Exception("Cannot insert element into " + getName(), ErrorCodes::NOT_IMPLEMENTED); }
|
||
StringRef getDataAt(size_t n) const override { throw Exception("Method getDataAt is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED); }
|
||
void insertData(const char * pos, size_t length) override { throw Exception("Method insertData is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED); }
|
||
|
||
StringRef serializeValueIntoArena(size_t n, Arena & arena, char const *& begin) const override
|
||
{
|
||
throw Exception("Method serializeValueIntoArena is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED);
|
||
}
|
||
|
||
const char * deserializeAndInsertFromArena(const char * pos) override
|
||
{
|
||
throw Exception("Method deserializeAndInsertFromArena is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED);
|
||
}
|
||
|
||
void getExtremes(Field & min, Field & max) const override
|
||
{
|
||
throw Exception("Method getExtremes is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED);
|
||
}
|
||
|
||
void insertRangeFrom(const IColumn & src, size_t start, size_t length) override
|
||
{
|
||
s += length;
|
||
}
|
||
|
||
ColumnPtr filter(const Filter & filt, ssize_t result_size_hint) const override
|
||
{
|
||
return cloneDummy(countBytesInFilter(filt));
|
||
}
|
||
|
||
ColumnPtr permute(const Permutation & perm, size_t limit) const override
|
||
{
|
||
if (s != perm.size())
|
||
throw Exception("Size of permutation doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
|
||
|
||
return cloneDummy(limit ? std::min(s, limit) : s);
|
||
}
|
||
|
||
void getPermutation(bool reverse, size_t limit, Permutation & res) const override
|
||
{
|
||
res.resize(s);
|
||
for (size_t i = 0; i < s; ++i)
|
||
res[i] = i;
|
||
}
|
||
|
||
ColumnPtr replicate(const Offsets_t & offsets) const override
|
||
{
|
||
if (s != offsets.size())
|
||
throw Exception("Size of offsets doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
|
||
|
||
return cloneDummy(s == 0 ? 0 : offsets.back());
|
||
}
|
||
|
||
private:
|
||
size_t s;
|
||
};
|
||
|
||
}
|