Skip to content

Commit

Permalink
Merge pull request #62693 from Avogar/mark-variant-comparable
Browse files Browse the repository at this point in the history
Mark DataTypeVariant as comparable
  • Loading branch information
Avogar committed Apr 18, 2024
2 parents 91a4d08 + eb540fc commit d844a1f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/DataTypes/DataTypeVariant.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class DataTypeVariant final : public IDataType
bool equals(const IDataType & rhs) const override;

bool isParametric() const override { return true; }
bool isComparable() const override { return true; }
bool haveSubtypes() const override { return true; }
bool textCanContainOnlyValidUTF8() const override;
bool haveMaximumSizeOfValue() const override;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1 str_1
1 str_2
1 1
1 2
7 changes: 7 additions & 0 deletions tests/queries/0_stateless/03096_variant_in_primary_key.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set allow_experimental_variant_type=1;
drop table if exists test;
create table test (id UInt64, v Variant(UInt64, String)) engine=MergeTree order by (id, v);
insert into test values (1, 1), (1, 'str_1'), (1, 2), (1, 'str_2');
select * from test;
drop table test;

0 comments on commit d844a1f

Please sign in to comment.