This is an automated email from the ASF dual-hosted git repository.
panxiaolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new c033c6239f [Bug](table-function) fix wrong result when seprator of
explode_split size more than one (#18824)
c033c6239f is described below
commit c033c6239f917ae4a430b4c4779e102aead24c32
Author: Pxl <[email protected]>
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 +--
.../data/nereids_p0/sql_functions/table_function/explode_split.out | 6 ++++++
.../nereids_p0/sql_functions/table_function/explode_split.groovy | 1 +
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/be/src/vec/exprs/table_function/vexplode_split.cpp
b/be/src/vec/exprs/table_function/vexplode_split.cpp
index 8d21a76a05..e832fc43c1 100644
--- a/be/src/vec/exprs/table_function/vexplode_split.cpp
+++ b/be/src/vec/exprs/table_function/vexplode_split.cpp
@@ -95,11 +95,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/data/nereids_p0/sql_functions/table_function/explode_split.out
b/regression-test/data/nereids_p0/sql_functions/table_function/explode_split.out
index a723f46dab..a430812264 100644
---
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
@@ -20,3 +20,9 @@
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
index c28f43c4b3..9f64864be7 100644
---
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
@@ -41,4 +41,5 @@ suite("explode_split") {
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: [email protected]
For additional commands, e-mail: [email protected]