mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Merge pull request #47860 from ClickHouse/fix-datetime-lc
Fix DateTime monotonicity check for LowCardinality
This commit is contained in:
commit
b0aab0d8ca
@ -2,8 +2,10 @@
|
||||
#include <DataTypes/DataTypeDate.h>
|
||||
#include <DataTypes/DataTypeDate32.h>
|
||||
#include <DataTypes/DataTypeDateTime.h>
|
||||
#include <Functions/IFunction.h>
|
||||
#include <DataTypes/DataTypeDateTime64.h>
|
||||
#include <DataTypes/DataTypeLowCardinality.h>
|
||||
|
||||
#include <Functions/IFunction.h>
|
||||
#include <Functions/extractTimeZoneFromFunctionArguments.h>
|
||||
#include <Functions/DateTimeTransforms.h>
|
||||
#include <Functions/TransformDateTime64.h>
|
||||
@ -60,6 +62,9 @@ public:
|
||||
|
||||
const auto * type_ptr = &type;
|
||||
|
||||
if (const auto * lc_type = checkAndGetDataType<DataTypeLowCardinality>(type_ptr))
|
||||
type_ptr = lc_type->getDictionaryType().get();
|
||||
|
||||
if (const auto * nullable_type = checkAndGetDataType<DataTypeNullable>(type_ptr))
|
||||
type_ptr = nullable_type->getNestedType().get();
|
||||
|
||||
|
@ -1 +1,2 @@
|
||||
22 0 1
|
||||
1970-01-01 02:00:02
|
||||
|
@ -1,4 +1,5 @@
|
||||
DROP TABLE IF EXISTS 02680_datetime64_monotonic_check;
|
||||
DROP TABLE IF EXISTS 02680_datetime_monotonic_check_lc;
|
||||
|
||||
CREATE TABLE 02680_datetime64_monotonic_check (`t` DateTime64(3), `x` Nullable(Decimal(18, 14)))
|
||||
ENGINE = MergeTree
|
||||
@ -13,3 +14,15 @@ WHERE toHour_Israel = 0
|
||||
GROUP BY toHour_UTC, toHour_Israel;
|
||||
|
||||
DROP TABLE 02680_datetime64_monotonic_check;
|
||||
|
||||
SET allow_suspicious_low_cardinality_types = 1;
|
||||
CREATE TABLE 02680_datetime_monotonic_check_lc (`timestamp` LowCardinality(UInt32))
|
||||
ENGINE = MergeTree
|
||||
ORDER BY timestamp
|
||||
SETTINGS index_granularity = 1;
|
||||
|
||||
INSERT INTO 02680_datetime_monotonic_check_lc VALUES (2);
|
||||
|
||||
SELECT toDateTime(timestamp, 'Asia/Jerusalem') FROM 02680_datetime_monotonic_check_lc WHERE toHour(toDateTime(timestamp, 'Asia/Jerusalem')) = 2;
|
||||
|
||||
DROP TABLE 02680_datetime_monotonic_check_lc
|
||||
|
Loading…
Reference in New Issue
Block a user