Make Enum comparable again [#CLICKHOUSE-3560].

This commit is contained in:
Alexey Milovidov 2018-02-05 21:39:45 +03:00
parent dc66a83902
commit d1785d92a7
4 changed files with 6 additions and 1 deletions

View File

@ -32,6 +32,7 @@ public:
bool isCategorial() const override { return true; }
bool isEnum() const override { return true; }
bool canBeInsideNullable() const override { return true; }
bool isComparable() const override { return true; };
};

View File

@ -273,7 +273,9 @@ public:
*/
virtual bool canBeUsedAsVersion() const { return false; };
/** Values of data type can be summed. Example: numbers, even nullable. Not Date/DateTime.
/** Values of data type can be summed (possibly with overflow, within the same data type).
* Example: numbers, even nullable. Not Date/DateTime. Not Enum.
* Enums can be passed to aggregate function 'sum', but the result is Int64, not Enum, so they are not summable.
*/
virtual bool isSummable() const { return false; };

View File

@ -0,0 +1 @@
Hello World 3

View File

@ -0,0 +1 @@
SELECT min(x), max(x), sum(x) FROM (SELECT CAST(arrayJoin([1, 2]) AS Enum8('Hello' = 1, 'World' = 2)) AS x);