mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 18:12:02 +00:00
Store only ColumnConst in ConstantValue
This commit is contained in:
parent
054c5e3c80
commit
ef4775c395
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <Columns/ColumnConst.h>
|
||||
#include <Columns/IColumn.h>
|
||||
#include <Core/Field.h>
|
||||
#include <DataTypes/IDataType.h>
|
||||
@ -11,7 +12,7 @@ class ConstantValue
|
||||
{
|
||||
public:
|
||||
ConstantValue(ColumnPtr column_, DataTypePtr data_type_)
|
||||
: column(std::move(column_))
|
||||
: column(wrapToColumnConst(column_))
|
||||
, data_type(std::move(data_type_))
|
||||
{}
|
||||
|
||||
@ -30,6 +31,14 @@ public:
|
||||
return data_type;
|
||||
}
|
||||
private:
|
||||
|
||||
static ColumnPtr wrapToColumnConst(ColumnPtr column_)
|
||||
{
|
||||
if (!isColumnConst(*column_))
|
||||
return ColumnConst::create(column_, 1);
|
||||
return column_;
|
||||
}
|
||||
|
||||
ColumnPtr column;
|
||||
DataTypePtr data_type;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user