mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
Renamed WithDictionary(Type) to LowCardinality(Type) and added TypeWithDictionary alias.
This commit is contained in:
parent
bd991a5f7a
commit
1be7c4122d
@ -6,6 +6,7 @@
|
||||
#include <Parsers/ASTLiteral.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Poco/String.h>
|
||||
#include <Common/StringUtils/StringUtils.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -53,6 +54,23 @@ DataTypePtr DataTypeFactory::get(const ASTPtr & ast) const
|
||||
|
||||
DataTypePtr DataTypeFactory::get(const String & family_name, const ASTPtr & parameters) const
|
||||
{
|
||||
if (endsWith(family_name, "WithDictionary"))
|
||||
{
|
||||
ASTPtr low_cardinality_params = std::make_shared<ASTExpressionList>();
|
||||
String param_name = family_name.substr(0, family_name.size() - strlen("WithDictionary"));
|
||||
if (parameters)
|
||||
{
|
||||
auto func = std::make_shared<ASTFunction>();
|
||||
func->name = param_name;
|
||||
func->arguments = parameters;
|
||||
low_cardinality_params->children.push_back(func);
|
||||
}
|
||||
else
|
||||
low_cardinality_params->children.push_back(std::make_shared<ASTIdentifier>(param_name));
|
||||
|
||||
return get("LowCardinality", low_cardinality_params);
|
||||
}
|
||||
|
||||
{
|
||||
DataTypesDictionary::const_iterator it = data_types.find(family_name);
|
||||
if (data_types.end() != it)
|
||||
|
@ -820,7 +820,7 @@ bool DataTypeWithDictionary::equals(const IDataType & rhs) const
|
||||
static DataTypePtr create(const ASTPtr & arguments)
|
||||
{
|
||||
if (!arguments || arguments->children.size() != 1)
|
||||
throw Exception("WithDictionary data type family must have single argument - type of elements",
|
||||
throw Exception("LowCardinality data type family must have single argument - type of elements",
|
||||
ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
|
||||
|
||||
return std::make_shared<DataTypeWithDictionary>(DataTypeFactory::instance().get(arguments->children[0]));
|
||||
@ -828,7 +828,7 @@ static DataTypePtr create(const ASTPtr & arguments)
|
||||
|
||||
void registerDataTypeWithDictionary(DataTypeFactory & factory)
|
||||
{
|
||||
factory.registerDataType("WithDictionary", create);
|
||||
factory.registerDataType("LowCardinality", create);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,9 +17,9 @@ public:
|
||||
|
||||
String getName() const override
|
||||
{
|
||||
return "WithDictionary(" + dictionary_type->getName() + ")";
|
||||
return "LowCardinality(" + dictionary_type->getName() + ")";
|
||||
}
|
||||
const char * getFamilyName() const override { return "WithDictionary"; }
|
||||
const char * getFamilyName() const override { return "LowCardinality"; }
|
||||
|
||||
void enumerateStreams(const StreamCallback & callback, SubstreamPath & path) const override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user