[fix](timev2) fix Type not implemented in fold by be (#26478)
This commit is contained in:
@ -195,6 +195,11 @@ string FoldConstantExecutor::_get_result(void* src, size_t size, const TypeDescr
|
||||
double val = *reinterpret_cast<double*>(src);
|
||||
return fmt::format("{}", val);
|
||||
}
|
||||
case TYPE_TIMEV2: {
|
||||
constexpr static auto ratio_to_time = (1000 * 1000);
|
||||
double val = *reinterpret_cast<double*>(src);
|
||||
return fmt::format("{}", val / ratio_to_time);
|
||||
}
|
||||
case TYPE_CHAR:
|
||||
case TYPE_VARCHAR:
|
||||
case TYPE_STRING:
|
||||
|
||||
13
regression-test/data/correctness/test_timev2_fold.out
Normal file
13
regression-test/data/correctness/test_timev2_fold.out
Normal file
@ -0,0 +1,13 @@
|
||||
-- This file is automatically generated. You should know what you did if you want to edit this
|
||||
-- !select1 --
|
||||
-07:00:00
|
||||
|
||||
-- !select2 --
|
||||
-07:00:00
|
||||
|
||||
-- !select3 --
|
||||
-07:00:00
|
||||
|
||||
-- !select4 --
|
||||
-07:00:00
|
||||
|
||||
35
regression-test/suites/correctness/test_timev2_fold.groovy
Normal file
35
regression-test/suites/correctness/test_timev2_fold.groovy
Normal file
@ -0,0 +1,35 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_timev2_fold") {
|
||||
sql """ set enable_nereids_planner=false,enable_fold_constant_by_be=false """
|
||||
qt_select1 """
|
||||
select timediff( convert_tz("2020-05-05 00:00:00", 'UTC', 'America/Los_Angeles'), "2020-05-05 00:00:00");
|
||||
"""
|
||||
sql """ set enable_nereids_planner=true,enable_fold_constant_by_be=false """
|
||||
qt_select2 """
|
||||
select timediff( convert_tz("2020-05-05 00:00:00", 'UTC', 'America/Los_Angeles'), "2020-05-05 00:00:00");
|
||||
"""
|
||||
sql """ set enable_nereids_planner=false,enable_fold_constant_by_be=true """
|
||||
qt_select3 """
|
||||
select timediff( convert_tz("2020-05-05 00:00:00", 'UTC', 'America/Los_Angeles'), "2020-05-05 00:00:00");
|
||||
"""
|
||||
sql """ set enable_nereids_planner=true,enable_fold_constant_by_be=true """
|
||||
qt_select4 """
|
||||
select timediff( convert_tz("2020-05-05 00:00:00", 'UTC', 'America/Los_Angeles'), "2020-05-05 00:00:00");
|
||||
"""
|
||||
}
|
||||
Reference in New Issue
Block a user