You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/12/24 07:27:50 UTC

[doris] branch master updated: [fix](scan) fix that be may core dump when the predicates are all false (#15332)

This is an automated email from the ASF dual-hosted git repository.

morningman 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 e72404c537 [fix](scan) fix that be may core dump when the predicates are all false (#15332)
e72404c537 is described below

commit e72404c53726b165d1a6ef76578e906d13aea115
Author: Xin Liao <li...@126.com>
AuthorDate: Sat Dec 24 15:27:43 2022 +0800

    [fix](scan) fix that be may core dump when the predicates are all false (#15332)
---
 be/src/vec/exec/scan/vscan_node.cpp                |  3 +
 .../correctness_p0/test_with_false_predicate.out   |  8 +++
 .../test_with_false_predicate.groovy               | 64 ++++++++++++++++++++++
 3 files changed, 75 insertions(+)

diff --git a/be/src/vec/exec/scan/vscan_node.cpp b/be/src/vec/exec/scan/vscan_node.cpp
index 881a674026..b0c495799b 100644
--- a/be/src/vec/exec/scan/vscan_node.cpp
+++ b/be/src/vec/exec/scan/vscan_node.cpp
@@ -102,6 +102,9 @@ Status VScanNode::alloc_resource(RuntimeState* state) {
     RETURN_IF_ERROR(ExecNode::alloc_resource(state));
     RETURN_IF_ERROR(_acquire_runtime_filter());
     RETURN_IF_ERROR(_process_conjuncts());
+    if (_eos) {
+        return Status::OK();
+    }
 
     std::list<VScanner*> scanners;
     RETURN_IF_ERROR(_init_scanners(&scanners));
diff --git a/regression-test/data/correctness_p0/test_with_false_predicate.out b/regression-test/data/correctness_p0/test_with_false_predicate.out
new file mode 100644
index 0000000000..5884eb2e3a
--- /dev/null
+++ b/regression-test/data/correctness_p0/test_with_false_predicate.out
@@ -0,0 +1,8 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sql --
+1	1	1	1
+2	2	2	2
+3	3	3	3
+
+-- !sql --
+
diff --git a/regression-test/suites/correctness_p0/test_with_false_predicate.groovy b/regression-test/suites/correctness_p0/test_with_false_predicate.groovy
new file mode 100644
index 0000000000..ffa64f99fa
--- /dev/null
+++ b/regression-test/suites/correctness_p0/test_with_false_predicate.groovy
@@ -0,0 +1,64 @@
+// 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_with_false_predicate") {
+    def tableName = "false_predicate_table"
+
+    sql """
+        DROP TABLE IF EXISTS $tableName 
+    """
+
+    sql """
+        CREATE TABLE IF NOT EXISTS `$tableName` (
+          `k1` int NOT NULL,
+          `k2` int NOT NULL,
+          `k3` int NOT NULL,
+          `v1` int NOT NULL
+        ) ENGINE=OLAP
+        DUPLICATE KEY(`k1`, `k2`, `k3`)
+        COMMENT "OLAP"
+        DISTRIBUTED BY HASH(`k1`) BUCKETS 1
+        PROPERTIES (
+        "replication_allocation" = "tag.location.default: 1",
+        "in_memory" = "false",
+        "storage_format" = "V2"
+        )
+    """
+
+    sql """
+        INSERT INTO $tableName VALUES (1, 1, 1, 1);
+    """
+    sql """
+        INSERT INTO $tableName VALUES (2, 2, 2, 2);
+    """
+    sql """
+        INSERT INTO $tableName VALUES (3, 3, 3, 3);
+    """
+
+    sql " sync "
+
+    qt_sql """
+        select * from $tableName order by k1;
+    """
+
+    qt_sql """
+        select k1, k2 from $tableName where BITMAP_EMPTY() is  NULL order by k1;
+    """
+
+    sql " DROP TABLE $tableName "
+
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org