Merge pull request #39113 from CurtizJ/tuple-lowcardinality

Keep `LowCardinality` type in `tuple()` function
This commit is contained in:
Anton Popov 2022-07-13 02:28:56 +02:00 committed by GitHub
commit df190b14b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 44 additions and 1 deletions

View File

@ -23,6 +23,7 @@ public:
/// array(..., Nothing, ...) -> Array(..., Nothing, ...)
bool useDefaultImplementationForNothing() const override { return false; }
bool useDefaultImplementationForConstants() const override { return true; }
bool useDefaultImplementationForLowCardinalityColumns() const override { return false; }
bool isVariadic() const override { return true; }
bool isSuitableForShortCircuitArgumentsExecution(const DataTypesWithConstInfo & /*arguments*/) const override { return false; }

View File

@ -68,6 +68,7 @@ public:
/// map(..., Nothing) -> Map(..., Nothing)
bool useDefaultImplementationForNothing() const override { return false; }
bool useDefaultImplementationForConstants() const override { return true; }
bool useDefaultImplementationForLowCardinalityColumns() const override { return false; }
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
{

View File

@ -28,6 +28,8 @@ public:
bool useDefaultImplementationForNothing() const override { return false; }
bool useDefaultImplementationForLowCardinalityColumns() const override { return false; }
bool isSuitableForShortCircuitArgumentsExecution(const DataTypesWithConstInfo & /*arguments*/) const override { return false; }
size_t getNumberOfArguments() const override

View File

@ -55,6 +55,7 @@ public:
/// tuple(..., Nothing, ...) -> Tuple(..., Nothing, ...)
bool useDefaultImplementationForNothing() const override { return false; }
bool useDefaultImplementationForConstants() const override { return true; }
bool useDefaultImplementationForLowCardinalityColumns() const override { return false; }
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
{

View File

@ -1 +1 @@
Const(UInt8)
Const(ColumnLowCardinality)

View File

@ -0,0 +1,12 @@
Array(LowCardinality(String))
Array(LowCardinality(String))
Array(LowCardinality(String))
Array(LowCardinality(String))
Array(String)
Array(String)
Array(String)
Array(String)
Map(LowCardinality(String), LowCardinality(String))
Map(LowCardinality(String), LowCardinality(String))
Map(LowCardinality(String), LowCardinality(String))
Map(LowCardinality(String), LowCardinality(String))

View File

@ -0,0 +1,14 @@
SELECT toTypeName([toLowCardinality('1'), toLowCardinality('2')]);
SELECT toTypeName([materialize(toLowCardinality('1')), toLowCardinality('2')]);
SELECT toTypeName([toLowCardinality('1'), materialize(toLowCardinality('2'))]);
SELECT toTypeName([materialize(toLowCardinality('1')), materialize(toLowCardinality('2'))]);
SELECT toTypeName([toLowCardinality('1'), '2']);
SELECT toTypeName([materialize(toLowCardinality('1')), '2']);
SELECT toTypeName([toLowCardinality('1'), materialize('2')]);
SELECT toTypeName([materialize(toLowCardinality('1')), materialize('2')]);
SELECT toTypeName(map(toLowCardinality('1'), toLowCardinality('2')));
SELECT toTypeName(map(materialize(toLowCardinality('1')), toLowCardinality('2')));
SELECT toTypeName(map(toLowCardinality('1'), materialize(toLowCardinality('2'))));
SELECT toTypeName(map(materialize(toLowCardinality('1')), materialize(toLowCardinality('2'))));

View File

@ -0,0 +1,4 @@
Tuple(LowCardinality(String), LowCardinality(UInt8))
Tuple(LowCardinality(String), LowCardinality(UInt8))
Tuple(LowCardinality(String), LowCardinality(UInt8))
Tuple(LowCardinality(String), LowCardinality(UInt8))

View File

@ -0,0 +1,6 @@
SET allow_suspicious_low_cardinality_types = 1;
SELECT toTypeName(tuple(toLowCardinality('1'), toLowCardinality(1)));
SELECT toTypeName(tuple(materialize(toLowCardinality('1')), toLowCardinality(1)));
SELECT toTypeName(tuple(toLowCardinality('1'), materialize(toLowCardinality(1))));
SELECT toTypeName(tuple(materialize(toLowCardinality('1')), materialize(toLowCardinality(1))));

View File

@ -0,0 +1 @@
ColumnLowCardinality

View File

@ -0,0 +1 @@
SELECT toColumnTypeName(toLowCardinality(materialize('foo')));