This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch branch-1.2-lts in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-1.2-lts by this push: new c0efc8652af [fix](streamload) fix NPE in stream load with null predicate on DateV2 and DateTimeV2 (#30114) c0efc8652af is described below commit c0efc8652afaf79b760bbdc6d840ca7a79130cec Author: Nitin-Kashyap <66766227+nitin-kash...@users.noreply.github.com> AuthorDate: Wed Jan 24 07:09:46 2024 +0530 [fix](streamload) fix NPE in stream load with null predicate on DateV2 and DateTimeV2 (#30114) Added is_null and is_non_null predicate handle for the DateTimeV2 and DateV2 types --- be/src/exprs/is_null_predicate.cpp | 4 ++ be/src/udf/udf.h | 1 + .../datetimev2/test_load_with_predicate.out | 6 +++ .../datatype_p0/datetimev2/test_data/test.csv | 5 ++ .../datetimev2/test_load_with_predicate.groovy | 60 ++++++++++++++++++++++ 5 files changed, 76 insertions(+) diff --git a/be/src/exprs/is_null_predicate.cpp b/be/src/exprs/is_null_predicate.cpp index 3b4b5b81a80..d82c42320e7 100644 --- a/be/src/exprs/is_null_predicate.cpp +++ b/be/src/exprs/is_null_predicate.cpp @@ -46,7 +46,9 @@ template BooleanVal IsNullPredicate::is_null(FunctionContext*, const LargeIntVal template BooleanVal IsNullPredicate::is_null(FunctionContext*, const FloatVal&); template BooleanVal IsNullPredicate::is_null(FunctionContext*, const DoubleVal&); template BooleanVal IsNullPredicate::is_null(FunctionContext*, const StringVal&); +template BooleanVal IsNullPredicate::is_null(FunctionContext*, const DateV2Val&); template BooleanVal IsNullPredicate::is_null(FunctionContext*, const DateTimeVal&); +template BooleanVal IsNullPredicate::is_null(FunctionContext*, const DateTimeV2Val&); template BooleanVal IsNullPredicate::is_null(FunctionContext*, const DecimalV2Val&); template BooleanVal IsNullPredicate::is_null(FunctionContext*, const CollectionVal&); @@ -60,7 +62,9 @@ template BooleanVal IsNullPredicate::is_not_null(FunctionContext*, const LargeIn template BooleanVal IsNullPredicate::is_not_null(FunctionContext*, const FloatVal&); template BooleanVal IsNullPredicate::is_not_null(FunctionContext*, const DoubleVal&); template BooleanVal IsNullPredicate::is_not_null(FunctionContext*, const StringVal&); +template BooleanVal IsNullPredicate::is_not_null(FunctionContext*, const DateV2Val&); template BooleanVal IsNullPredicate::is_not_null(FunctionContext*, const DateTimeVal&); +template BooleanVal IsNullPredicate::is_not_null(FunctionContext*, const DateTimeV2Val&); template BooleanVal IsNullPredicate::is_not_null(FunctionContext*, const DecimalV2Val&); template BooleanVal IsNullPredicate::is_not_null(FunctionContext*, const CollectionVal&); diff --git a/be/src/udf/udf.h b/be/src/udf/udf.h index 49758f40d1e..f5301015d23 100644 --- a/be/src/udf/udf.h +++ b/be/src/udf/udf.h @@ -924,6 +924,7 @@ using doris_udf::DoubleVal; using doris_udf::StringVal; using doris_udf::DecimalV2Val; using doris_udf::DateTimeVal; +using doris_udf::DateTimeV2Val; using doris_udf::HllVal; using doris_udf::FunctionContext; using doris_udf::CollectionVal; diff --git a/regression-test/data/datatype_p0/datetimev2/test_load_with_predicate.out b/regression-test/data/datatype_p0/datetimev2/test_load_with_predicate.out new file mode 100644 index 00000000000..a4a9184535b --- /dev/null +++ b/regression-test/data/datatype_p0/datetimev2/test_load_with_predicate.out @@ -0,0 +1,6 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !select_default -- +1 2012-12-01T10:10:10 +2 2012-12-02T20:20:20 +5 2012-12-05T10:10:10 + diff --git a/regression-test/suites/datatype_p0/datetimev2/test_data/test.csv b/regression-test/suites/datatype_p0/datetimev2/test_data/test.csv new file mode 100644 index 00000000000..ff923e08ac8 --- /dev/null +++ b/regression-test/suites/datatype_p0/datetimev2/test_data/test.csv @@ -0,0 +1,5 @@ +1,2012-12-01 10:10:10 +2,2012-12-02 20:20:20 +3,null +4,2012-12-04 40:40:40 +5,2012-12-05 10:10:10 diff --git a/regression-test/suites/datatype_p0/datetimev2/test_load_with_predicate.groovy b/regression-test/suites/datatype_p0/datetimev2/test_load_with_predicate.groovy new file mode 100644 index 00000000000..d9e54d97400 --- /dev/null +++ b/regression-test/suites/datatype_p0/datetimev2/test_load_with_predicate.groovy @@ -0,0 +1,60 @@ +// 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. + +import org.codehaus.groovy.runtime.IOGroovyMethods + +import java.nio.charset.StandardCharsets +import java.nio.file.Files +import java.nio.file.Paths + +suite("test_load_with_predicate") { + def dbName = "test_load" + sql "CREATE DATABASE IF NOT EXISTS ${dbName}" + sql "USE $dbName" + + def tableName = "test_datetimev2_load" + try { + sql """ DROP TABLE IF EXISTS ${tableName} """ + sql """ + CREATE TABLE IF NOT EXISTS ${tableName} ( + `a` INT, + `b` datetimev2(3) NULL COMMENT "" + ) ENGINE=OLAP + DUPLICATE KEY(`a`) + COMMENT 'OLAP' + DISTRIBUTED BY HASH(`a`) BUCKETS 1 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1" + ); + """ + + def uri = """${context.config.feHttpUser}:${context.config.feHttpPassword}""" + def api = """http://${context.config.feHttpAddress}/api/""" + dbName + "/" + tableName + "/_stream_load" + def csv = """${context.file.parent}/test_data/test.csv""" + + command = ['curl', '--location-trusted', '-u', uri, '-H', 'column_separator:,', '-H', 'format:csv','-H', 'where:b is not null', '-T', csv, api ] + process = command.execute() + code = process.waitFor() + err = IOGroovyMethods.getText(new BufferedReader(new InputStreamReader(process.getErrorStream()))) + out = process.getText() + logger.info("Run command: command=" + command + ",code=" + code + ", out=" + out + ", err=" + err) + assertEquals(code, 0) + qt_select_default """ SELECT * FROM ${tableName} t ORDER BY a; """ + } finally { + try_sql("DROP TABLE IF EXISTS ${tableName}") + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org