mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Fix timezone argument for DateTime64
It should be marked with always const, otherwise it will bail: Code: 44, e.displayText() = DB::Exception: Illegal column String of time zone argument of function, must be constant string: While processing toDateTime(-1, 1, 'GMT'), Stack trace (when copying this message, always include the lines below):
This commit is contained in:
parent
f4c2048bf2
commit
0627ba0e36
@ -1294,7 +1294,12 @@ public:
|
||||
bool useDefaultImplementationForNulls() const override { return checked_return_type; }
|
||||
|
||||
bool useDefaultImplementationForConstants() const override { return true; }
|
||||
ColumnNumbers getArgumentsThatAreAlwaysConstant() const override { return {1}; }
|
||||
ColumnNumbers getArgumentsThatAreAlwaysConstant() const override
|
||||
{
|
||||
if constexpr (std::is_same_v<ToDataType, DataTypeDateTime64>)
|
||||
return {2};
|
||||
return {1};
|
||||
}
|
||||
bool canBeExecutedOnDefaultArguments() const override { return false; }
|
||||
|
||||
ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr & result_type, size_t input_rows_count) const override
|
||||
|
@ -3,3 +3,7 @@ select toDateTime64(toDateTime(1), 2);
|
||||
1970-01-01 03:00:01.00
|
||||
select toDateTime64(toDate(1), 2);
|
||||
1970-01-02 00:00:00.00
|
||||
select toDateTime64(toDateTime(1), 2, 'GMT');
|
||||
1970-01-01 00:00:01.00
|
||||
select toDateTime64(toDate(1), 2, 'GMT');
|
||||
1970-01-02 00:00:00.00
|
||||
|
@ -1,3 +1,5 @@
|
||||
-- { echo }
|
||||
select toDateTime64(toDateTime(1), 2);
|
||||
select toDateTime64(toDate(1), 2);
|
||||
select toDateTime64(toDateTime(1), 2, 'GMT');
|
||||
select toDateTime64(toDate(1), 2, 'GMT');
|
||||
|
Loading…
Reference in New Issue
Block a user