Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](function) Fix wrong nullable processing for convert_tz #38764

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions be/src/vec/functions/function_convert_tz.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,6 @@ class FunctionConvertTZ : public IFunction {
std::make_shared<DataTypeString>()};
}

bool use_default_implementation_for_nulls() const override { return false; }

Status close(FunctionContext* context, FunctionContext::FunctionStateScope scope) override {
return Status::OK();
}

Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
size_t result, size_t input_rows_count) const override {
auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0);
Expand All @@ -110,10 +104,6 @@ class FunctionConvertTZ : public IFunction {

default_preprocess_parameter_columns(argument_columns, col_const, {1, 2}, block, arguments);

for (int i = 0; i < 3; i++) {
check_set_nullable(argument_columns[i], result_null_map_column, col_const[i]);
}

if (col_const[1] && col_const[2]) {
auto result_column = ColumnType::create();
execute_tz_const(context, assert_cast<const ColumnType*>(argument_columns[0].get()),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !sql1 --
2024-04-18T23:20
2024-04-18T23:20
2024-04-18T23:20
2024-04-18T23:20
2024-04-18T23:20
2024-04-18T23:20
2024-04-18T23:20
2024-04-18T23:20
2024-04-18T23:20
2024-04-18T23:20
2024-04-18T23:20
2024-04-18T23:20
2024-04-18T23:20
2024-04-18T23:20
2024-04-18T23:20
2024-04-18T23:20
2024-04-18T23:20
2024-04-18T23:20
2024-04-18T23:20
2024-04-18T23:20

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// 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_convert_tz") {
sql """
CREATE TABLE `cvt_tz` (
`rowid` int NULL,
`dt` datetime NULL,
`property_value` varchar(65533) NULL
) ENGINE=OLAP
DUPLICATE KEY(`rowid`, `dt`, `property_value`)
DISTRIBUTED BY HASH(`rowid`) BUCKETS 10
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);
"""

sql """insert into cvt_tz select number, "2024-04-18 23:20:00", NULL from numbers("number" = "20"); """

order_qt_sql1 """
select convert_tz(dt, '+00:00', IF(property_value IS NULL, '+00:00', property_value)) from cvt_tz
"""
}
Loading