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
commit 9a74bec25892c9749b0805c8baa3b6bd1028fd72 Author: Pxl <pxl...@qq.com> AuthorDate: Fri Apr 21 11:00:47 2023 +0800 [Bug](table-function) fix wrong result when seprator of explode_split size more than one (#18824) fix wrong result when seprator of explode_split size more than one --- be/src/vec/exprs/table_function/vexplode_split.cpp | 3 +- regression-test/conf/regression-conf.groovy | 52 +++++++++++----------- .../sql_functions/table_function/explode_split.out | 25 +++++++++++ .../table_function/explode_split.groovy | 37 +++++++++++++++ 4 files changed, 89 insertions(+), 28 deletions(-) diff --git a/be/src/vec/exprs/table_function/vexplode_split.cpp b/be/src/vec/exprs/table_function/vexplode_split.cpp index 3401474715..39a3dbd56d 100644 --- a/be/src/vec/exprs/table_function/vexplode_split.cpp +++ b/be/src/vec/exprs/table_function/vexplode_split.cpp @@ -89,11 +89,10 @@ Status VExplodeSplitTableFunction::process_row(size_t row_idx) { if (first != second) { output.emplace_back(strv.substr(std::distance(strv.begin(), first), std::distance(first, second))); - first = std::next(second); } else { output.emplace_back("", 0); - first = std::next(second, delims.size()); } + first = std::next(second, delims.size()); if (second == last) { break; diff --git a/regression-test/conf/regression-conf.groovy b/regression-test/conf/regression-conf.groovy index fa2a4e3cc2..cb3956f9e2 100644 --- a/regression-test/conf/regression-conf.groovy +++ b/regression-test/conf/regression-conf.groovy @@ -23,12 +23,11 @@ defaultDb = "regression_test" // add useLocalSessionState so that the jdbc will not send // init cmd like: select @@session.tx_read_only // at each time we connect. -// add allowLoadLocalInfile so that the jdbc can execute mysql load data from client. -jdbcUrl = "jdbc:mysql://127.0.0.1:9030/?useLocalSessionState=true&allowLoadLocalInfile=true" +jdbcUrl = "jdbc:mysql://127.0.0.1:9235/?useLocalSessionState=true&allowLoadLocalInfile=true" jdbcUser = "root" jdbcPassword = "" -feHttpAddress = "127.0.0.1:8030" +feHttpAddress = "127.0.0.1:8335" feHttpUser = "root" feHttpPassword = "" @@ -50,9 +49,9 @@ testDirectories = "" // this groups will not be executed excludeGroups = "" // this suites will not be executed -excludeSuites = "test_broker_load" +excludeSuites = "" // this directories will not be executed -excludeDirectories = "segcompaction_p1" +excludeDirectories = "" customConf1 = "test_custom_conf_value" @@ -65,8 +64,8 @@ brokerName = "broker_name" // broker load test config enableBrokerLoad=true -ak="" -sk="" +ak="AKIDPhmeKo46sPhkZ9USWQEqGTSDsW5Xr6IL" +sk="xmT2Uoz0vgGkbKr6A4mGWcWCiBVcYJSV" // jdbc connector test config // To enable jdbc test, you need first start mysql/pg container. @@ -75,8 +74,6 @@ enableJdbcTest=false mysql_57_port=3316 pg_14_port=5442 oracle_11_port=1521 -sqlserver_2022_port=1433 -clickhouse_22_port=8123 // hive catalog test config // To enable jdbc test, you need first start hive container. @@ -94,34 +91,37 @@ es_8_port=39200 //hive catalog test config for bigdata -enableExternalHiveTest = false -extHiveHmsHost = "***.**.**.**" +enableExternalHiveTest = true +extHiveHmsHost = "172.21.16.47" extHiveHmsPort = 7004 +extHiveHmsUser = "root" +extHiveHmsPassword= "Cfplhys@2022" extHdfsPort = 4007 -extHiveHmsUser = "****" -extHiveHmsPassword= "***********" //mysql jdbc connector test config for bigdata -enableExternalMysqlTest = false -extMysqlHost = "***.**.**.**" +enableExternalMysqlTest = true +extMysqlHost = "172.21.48.3" extMysqlPort = 3306 -extMysqlUser = "****" -extMysqlPassword = "***********" +extMysqlUser = "root" +extMysqlPassword = "Cfplhys@2022" //postgresql jdbc connector test config for bigdata -enableExternalPgTest = false -extPgHost = "***.**.**.*" +enableExternalPgTest = true +extPgHost = "172.21.48.9" extPgPort = 5432 -extPgUser = "****" -extPgPassword = "***********" +extPgUser = "root" +extPgPassword = "Cfplhys@2022" // elasticsearch external test config for bigdata -enableExternalEsTest = false -extEsHost = "***********" -extEsPort = 9200 -extEsUser = "*******" -extEsPassword = "***********" +enableExternalEsTest = true +extEsHost = "172.21.0.138" +extEsPort = 9002 +extEsUser = "elastic" +extEsPassword = "Cfplhys@2022" s3Endpoint = "cos.ap-hongkong.myqcloud.com" s3BucketName = "doris-build-hk-1308700295" s3Region = "ap-hongkong" + +sf1DataPath = "/mnt/disk2/yunyou/git/doris1.2/test-data-cache" +cacheDataPath = "/mnt/disk2/yunyou/git/doris1.2/test-data-cache" diff --git a/regression-test/data/nereids_p0/sql_functions/table_function/explode_split.out b/regression-test/data/nereids_p0/sql_functions/table_function/explode_split.out new file mode 100644 index 0000000000..b60f5f7547 --- /dev/null +++ b/regression-test/data/nereids_p0/sql_functions/table_function/explode_split.out @@ -0,0 +1,25 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !explode_split -- +1 a,b,c a +1 a,b,c b +1 a,b,c c +-- !explode_split -- +1 a,b,c a a +1 a,b,c a b +1 a,b,c a c +1 a,b,c b a +1 a,b,c b b +1 a,b,c b c +1 a,b,c c a +1 a,b,c c b +1 a,b,c c c +-- !explode_split -- +6 a +6 b +6 c + +-- !explode_split -- +啊 +啊 +额 +啊 diff --git a/regression-test/suites/nereids_p0/sql_functions/table_function/explode_split.groovy b/regression-test/suites/nereids_p0/sql_functions/table_function/explode_split.groovy new file mode 100644 index 0000000000..65404ab8fb --- /dev/null +++ b/regression-test/suites/nereids_p0/sql_functions/table_function/explode_split.groovy @@ -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("explode_split") { + def tableName = "test_lv_str" + sql """ DROP TABLE IF EXISTS ${tableName} """ + sql """ + CREATE TABLE IF NOT EXISTS ${tableName} + (k1 INT, k2 STRING) + UNIQUE KEY(k1) DISTRIBUTED BY HASH(k1) BUCKETS 8 + PROPERTIES("replication_num" = "1") + """ + sql """ INSERT INTO ${tableName} VALUES (1, 'a,b,c') """ + qt_explode_split """ select * from ${tableName} + lateral view explode_split(k2, ',') tmp1 as e1 """ + qt_explode_split """ select * from ${tableName} + lateral view explode_split(k2, ',') tmp1 as e1 + lateral view explode_split(k2, ',') tmp2 as e2 """ + qt_explode_split """ WITH example1 AS ( select 6 AS k1 ,'a,b,c' AS k2) + select k1, e1 from example1 + lateral view explode_split(k2, ',') tmp as e1 """ + + qt_explode_split """ select e1 from (select 1 k1) as t lateral view explode_split("啊,啊,额,啊",",") tmp1 as e1; """ +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org