mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-25 03:00:49 +00:00
dbms: cleanup [#METR-19266]
This commit is contained in:
parent
e138621b7c
commit
e822631310
@ -307,6 +307,17 @@ using ColumnConstString = ColumnConst<String>;
|
|||||||
using ColumnConstArray = ColumnConst<Array>;
|
using ColumnConstArray = ColumnConst<Array>;
|
||||||
using ColumnConstTuple = ColumnConst<Tuple>;
|
using ColumnConstTuple = ColumnConst<Tuple>;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
inline bool ColumnConst<Null>::isNull() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
inline StringRef ColumnConst<Null>::getDataAt(size_t n) const
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T> ColumnPtr ColumnConst<T>::convertToFullColumn() const
|
template <typename T> ColumnPtr ColumnConst<T>::convertToFullColumn() const
|
||||||
{
|
{
|
||||||
|
@ -23,6 +23,7 @@ public:
|
|||||||
ColumnNullable(ColumnPtr nested_column_, ColumnPtr null_map_);
|
ColumnNullable(ColumnPtr nested_column_, ColumnPtr null_map_);
|
||||||
std::string getName() const override { return "ColumnNullable(" + nested_column->getName() + ")"; }
|
std::string getName() const override { return "ColumnNullable(" + nested_column->getName() + ")"; }
|
||||||
bool isNumeric() const override { return nested_column->isNumeric(); }
|
bool isNumeric() const override { return nested_column->isNumeric(); }
|
||||||
|
bool isNumericNotNullable() const override { return false; }
|
||||||
bool isConst() const override { return nested_column->isConst(); }
|
bool isConst() const override { return nested_column->isConst(); }
|
||||||
bool isFixed() const override { return nested_column->isFixed(); }
|
bool isFixed() const override { return nested_column->isFixed(); }
|
||||||
bool isNullable() const override { return true; }
|
bool isNullable() const override { return true; }
|
||||||
|
@ -45,6 +45,9 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual bool isNumeric() const { return false; }
|
virtual bool isNumeric() const { return false; }
|
||||||
|
|
||||||
|
/// Is this column numeric and not nullable?
|
||||||
|
virtual bool isNumericNotNullable() const { return isNumeric(); }
|
||||||
|
|
||||||
/** Столбец представляет собой константу.
|
/** Столбец представляет собой константу.
|
||||||
*/
|
*/
|
||||||
virtual bool isConst() const { return false; }
|
virtual bool isConst() const { return false; }
|
||||||
|
@ -15,6 +15,7 @@ public:
|
|||||||
std::string getName() const override { return "Nullable(" + nested_data_type->getName() + ")"; }
|
std::string getName() const override { return "Nullable(" + nested_data_type->getName() + ")"; }
|
||||||
bool isNullable() const override { return true; }
|
bool isNullable() const override { return true; }
|
||||||
bool isNumeric() const override { return nested_data_type->isNumeric(); }
|
bool isNumeric() const override { return nested_data_type->isNumeric(); }
|
||||||
|
bool isNumericNotNullable() const override { return false; }
|
||||||
bool behavesAsNumber() const override { return nested_data_type->behavesAsNumber(); }
|
bool behavesAsNumber() const override { return nested_data_type->behavesAsNumber(); }
|
||||||
DataTypePtr clone() const override { return std::make_shared<DataTypeNullable>(nested_data_type->clone()); }
|
DataTypePtr clone() const override { return std::make_shared<DataTypeNullable>(nested_data_type->clone()); }
|
||||||
void serializeBinary(const IColumn & column, WriteBuffer & ostr, size_t offset = 0, size_t limit = 0) const override;
|
void serializeBinary(const IColumn & column, WriteBuffer & ostr, size_t offset = 0, size_t limit = 0) const override;
|
||||||
|
@ -33,11 +33,14 @@ public:
|
|||||||
/// Is this type nullable?
|
/// Is this type nullable?
|
||||||
virtual bool isNullable() const { return false; }
|
virtual bool isNullable() const { return false; }
|
||||||
|
|
||||||
/// Является ли тип числовым. Дата и дата-с-временем тоже считаются такими.
|
/// Is this type numeric? Date and DateTime types are considered as such.
|
||||||
virtual bool isNumeric() const { return false; }
|
virtual bool isNumeric() const { return false; }
|
||||||
|
|
||||||
/// Если тип числовой, уместны ли с ним все арифметические операции и приведение типов.
|
/// Is this type numeric and not nullable?
|
||||||
/// true для чисел, false для даты и даты-с-временем.
|
virtual bool isNumericNotNullable() const { return isNumeric(); }
|
||||||
|
|
||||||
|
/// If this type is numeric, are all the arithmetic operations and type casting
|
||||||
|
/// relevant for it? True for numbers. False for Date and DateTime types.
|
||||||
virtual bool behavesAsNumber() const { return false; }
|
virtual bool behavesAsNumber() const { return false; }
|
||||||
|
|
||||||
/// Клонировать
|
/// Клонировать
|
||||||
|
@ -15,30 +15,6 @@
|
|||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
|
||||||
template <>
|
|
||||||
bool ColumnConst<Null>::isNull() const
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
|
||||||
StringRef ColumnConst<Null>::getDataAt(size_t n) const
|
|
||||||
{
|
|
||||||
return StringRef{};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
|
||||||
StringRef ColumnConst<Null>::getDataAtWithTerminatingZero(size_t n) const
|
|
||||||
{
|
|
||||||
throw Exception("Method getDataAtWithTerminatingZero is not supported for " + this->getName(), ErrorCodes::NOT_IMPLEMENTED);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
|
||||||
UInt64 ColumnConst<Null>::get64(size_t n) const
|
|
||||||
{
|
|
||||||
throw Exception("Method get64 is not supported for " + this->getName(), ErrorCodes::NOT_IMPLEMENTED);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
ColumnPtr ColumnConst<Null>::convertToFullColumn() const
|
ColumnPtr ColumnConst<Null>::convertToFullColumn() const
|
||||||
{
|
{
|
||||||
|
@ -93,8 +93,11 @@ Block SummingSortedBlockInputStream::readImpl()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/// Оставляем только числовые типы. При чём, даты и даты-со-временем здесь такими не считаются.
|
/// Оставляем только числовые типы. При чём, даты и даты-со-временем здесь такими не считаются.
|
||||||
if (!column.type->isNumeric() || column.type->getName() == "Date" ||
|
if (!column.type->isNumeric() ||
|
||||||
column.type->getName() == "DateTime")
|
column.type->getName() == "Date" ||
|
||||||
|
column.type->getName() == "DateTime" ||
|
||||||
|
column.type->getName() == "Nullable(Date)" ||
|
||||||
|
column.type->getName() == "Nullable(DateTime)")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/// Входят ли в PK?
|
/// Входят ли в PK?
|
||||||
|
@ -390,7 +390,7 @@ AggregatedDataVariants::Type Aggregator::chooseAggregationMethod(const ConstColu
|
|||||||
return AggregatedDataVariants::Type::without_key;
|
return AggregatedDataVariants::Type::without_key;
|
||||||
|
|
||||||
/// Если есть один числовой ключ, который помещается в 64 бита
|
/// Если есть один числовой ключ, который помещается в 64 бита
|
||||||
if (params.keys_size == 1 && key_columns[0]->isNumeric())
|
if (params.keys_size == 1 && key_columns[0]->isNumericNotNullable())
|
||||||
{
|
{
|
||||||
size_t size_of_field = key_columns[0]->sizeOfField();
|
size_t size_of_field = key_columns[0]->sizeOfField();
|
||||||
if (size_of_field == 1)
|
if (size_of_field == 1)
|
||||||
|
@ -45,7 +45,7 @@ Join::Type Join::chooseMethod(const ConstColumnPlainPtrs & key_columns, bool & k
|
|||||||
keys_fit_128_bits = false;
|
keys_fit_128_bits = false;
|
||||||
|
|
||||||
/// Если есть один числовой ключ, который помещается в 64 бита
|
/// Если есть один числовой ключ, который помещается в 64 бита
|
||||||
if (keys_size == 1 && key_columns[0]->isNumeric())
|
if (keys_size == 1 && key_columns[0]->isNumericNotNullable())
|
||||||
return Type::KEY_64;
|
return Type::KEY_64;
|
||||||
|
|
||||||
/// Если есть один строковый ключ, то используем хэш-таблицу с ним
|
/// Если есть один строковый ключ, то используем хэш-таблицу с ним
|
||||||
|
@ -116,7 +116,7 @@ SetVariants::Type SetVariants::chooseMethod(const ConstColumnPlainPtrs & key_col
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Если есть один числовой ключ, который помещается в 64 бита
|
/// Если есть один числовой ключ, который помещается в 64 бита
|
||||||
if (keys_size == 1 && key_columns[0]->isNumeric())
|
if (keys_size == 1 && key_columns[0]->isNumericNotNullable())
|
||||||
{
|
{
|
||||||
size_t size_of_field = key_columns[0]->sizeOfField();
|
size_t size_of_field = key_columns[0]->sizeOfField();
|
||||||
if (size_of_field == 1)
|
if (size_of_field == 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user