mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Merge pull request #23992 from MaxWk/enable-datatime64-version-column
enable DateTime64 to be version column
This commit is contained in:
commit
8ede5c736a
@ -35,6 +35,8 @@ public:
|
||||
|
||||
bool canBePromoted() const override { return false; }
|
||||
|
||||
bool canBeUsedAsVersion() const override { return true; }
|
||||
|
||||
protected:
|
||||
SerializationPtr doGetDefaultSerialization() const override;
|
||||
};
|
||||
|
@ -177,7 +177,7 @@ public:
|
||||
*/
|
||||
virtual bool canBeComparedWithCollation() const { return false; }
|
||||
|
||||
/** If the type is totally comparable (Ints, Date, DateTime, not nullable, not floats)
|
||||
/** If the type is totally comparable (Ints, Date, DateTime, DateTime64, not nullable, not floats)
|
||||
* and "simple" enough (not String, FixedString) to be used as version number
|
||||
* (to select rows with maximum version).
|
||||
*/
|
||||
|
@ -648,7 +648,7 @@ void MergeTreeData::MergingParams::check(const StorageInMemoryMetadata & metadat
|
||||
throw Exception("The column " + version_column +
|
||||
" cannot be used as a version column for storage " + storage +
|
||||
" because it is of type " + column.type->getName() +
|
||||
" (must be of an integer type or of type Date or DateTime)", ErrorCodes::BAD_TYPE_OF_FIELD);
|
||||
" (must be of an integer type or of type Date/DateTime/DateTime64)", ErrorCodes::BAD_TYPE_OF_FIELD);
|
||||
miss_column = false;
|
||||
break;
|
||||
}
|
||||
|
@ -0,0 +1,3 @@
|
||||
1 1970-01-01 08:25:46.300800003 a1
|
||||
2 1970-01-01 08:25:46.300800005 a1
|
||||
3 1970-01-01 08:25:46.300800005 c1
|
@ -0,0 +1,16 @@
|
||||
drop table if exists replacing;
|
||||
create table replacing( `A` Int64, `D` DateTime64(9), `S` String) ENGINE = ReplacingMergeTree(D) ORDER BY A;
|
||||
|
||||
insert into replacing values (1,'1970-01-01 08:25:46.300800000','a');
|
||||
insert into replacing values (2,'1970-01-01 08:25:46.300800002','b');
|
||||
insert into replacing values (1,'1970-01-01 08:25:46.300800003','a1');
|
||||
insert into replacing values (1,'1970-01-01 08:25:46.300800002','a2');
|
||||
insert into replacing values (2,'1970-01-01 08:25:46.300800004','b1');
|
||||
insert into replacing values (3,'1970-01-01 08:25:46.300800005','c1');
|
||||
insert into replacing values (2,'1970-01-01 08:25:46.300800005','a1');
|
||||
|
||||
OPTIMIZE TABLE replacing FINAL;
|
||||
|
||||
select * from replacing;
|
||||
|
||||
drop table replacing;
|
Loading…
Reference in New Issue
Block a user