This is an automated email from the ASF dual-hosted git repository.
diwu 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 4dac2d3b94 [Fix](Plan)StreamLoad cannot be parsed correctly when it
contains complex where conditions (#23874)
4dac2d3b94 is described below
commit 4dac2d3b943241f2b818181d699da97c5e58b75f
Author: Calvin Kirs <[email protected]>
AuthorDate: Tue Sep 5 11:26:59 2023 +0800
[Fix](Plan)StreamLoad cannot be parsed correctly when it contains complex
where conditions (#23874)
---
.../apache/doris/planner/StreamLoadPlanner.java | 11 +++-
.../stream_load/test_include_where_expr.json | 1 +
.../test_stream_load_include_where_expr.groovy | 60 ++++++++++++++++++++++
3 files changed, 71 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/planner/StreamLoadPlanner.java
b/fe/fe-core/src/main/java/org/apache/doris/planner/StreamLoadPlanner.java
index 5bf07f1f72..63c068e057 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/StreamLoadPlanner.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/StreamLoadPlanner.java
@@ -212,6 +212,11 @@ public class StreamLoadPlanner {
}
}
+ scanTupleDesc.setTable(destTable);
+ analyzer.registerTupleDescriptor(scanTupleDesc);
+ if (null != taskInfo.getWhereExpr()) {
+ taskInfo.getWhereExpr().analyze(analyzer);
+ }
// create scan node
FileLoadScanNode fileScanNode = new FileLoadScanNode(new
PlanNodeId(0), scanTupleDesc);
// 1. create file group
@@ -416,7 +421,11 @@ public class StreamLoadPlanner {
throw new DdlException("Column is not SUM AggregateType.
column:" + col.getName());
}
}
-
+ scanTupleDesc.setTable(destTable);
+ analyzer.registerTupleDescriptor(scanTupleDesc);
+ if (null != taskInfo.getWhereExpr()) {
+ taskInfo.getWhereExpr().analyze(analyzer);
+ }
// create scan node
FileLoadScanNode fileScanNode = new FileLoadScanNode(new
PlanNodeId(0), scanTupleDesc);
// 1. create file group
diff --git
a/regression-test/data/load_p0/stream_load/test_include_where_expr.json
b/regression-test/data/load_p0/stream_load/test_include_where_expr.json
new file mode 100644
index 0000000000..b193dd1a6d
--- /dev/null
+++ b/regression-test/data/load_p0/stream_load/test_include_where_expr.json
@@ -0,0 +1 @@
+{"a":"3","b":"2","c":"389","d":"doris"}
\ No newline at end of file
diff --git
a/regression-test/suites/load_p0/stream_load/test_stream_load_include_where_expr.groovy
b/regression-test/suites/load_p0/stream_load/test_stream_load_include_where_expr.groovy
new file mode 100644
index 0000000000..a94ecd05a1
--- /dev/null
+++
b/regression-test/suites/load_p0/stream_load/test_stream_load_include_where_expr.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.
+
+suite("test_stream_load_include_where_expr", "p0") {
+ // define a sql table
+ def tableName = "tbl_test_stream_load_include_where_expr"
+
+ sql """ DROP TABLE IF EXISTS ${tableName} """
+ sql """
+ CREATE TABLE IF NOT EXISTS ${tableName}
+ (
+ `a` INT COMMENT 'timestamp',
+ `b` INT COMMENT 'a int value',
+ `c` INT COMMENT 'b int value',
+ `d` varchar(100)
+ )
+ DUPLICATE KEY(`a`)
+ DISTRIBUTED BY HASH(a) BUCKETS AUTO
+ properties(
+ "replication_num" = "1"
+ );
+ """
+
+ streamLoad {
+ table "${tableName}"
+ set 'columns', 'a, b, c, d'
+ set 'format', 'json'
+ set 'where', 'd = \'doris\' or d = \'asf\' or b = 9 or b =8'
+
+ file 'test_include_where_expr.json'
+ time 10000 // limit inflight 10s
+
+ check { result, exception, startTime, endTime ->
+ if (exception != null) {
+ throw exception
+ }
+ log.info("Stream load result: ${result}".toString())
+ def json = parseJson(result)
+ assertEquals("success", json.Status.toLowerCase())
+ assertEquals(1, json.NumberTotalRows)
+ assertEquals(1,json.NumberLoadedRows)
+ }
+ }
+
+}
+
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]