quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jianq...@apache.org
Subject incubator-quickstep git commit: Fixed the bug regarding EliminateEmptyNode and InsertSelection.
Date Fri, 04 May 2018 19:02:06 GMT
Repository: incubator-quickstep
Updated Branches:
  refs/heads/master 876f12ba5 -> 77287a788


Fixed the bug regarding EliminateEmptyNode and InsertSelection.


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/77287a78
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/77287a78
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/77287a78

Branch: refs/heads/master
Commit: 77287a78890284139273dd5344e7d9b141f7ee25
Parents: 876f12b
Author: Zuyu Zhang <zuyu@cs.wisc.edu>
Authored: Fri May 4 13:04:02 2018 -0500
Committer: Zuyu Zhang <zuyu@cs.wisc.edu>
Committed: Fri May 4 13:04:02 2018 -0500

----------------------------------------------------------------------
 cli/tests/command_executor/Analyze.test      |  4 ++++
 query_optimizer/rules/EliminateEmptyNode.cpp | 19 ++++++++++++++-----
 2 files changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/77287a78/cli/tests/command_executor/Analyze.test
----------------------------------------------------------------------
diff --git a/cli/tests/command_executor/Analyze.test b/cli/tests/command_executor/Analyze.test
index b0bf090..ff20d9e 100644
--- a/cli/tests/command_executor/Analyze.test
+++ b/cli/tests/command_executor/Analyze.test
@@ -61,11 +61,15 @@ SELECT MIN(src) FROM r;
 +-----------+
 ==
 
+INSERT INTO r SELECT * FROM s;
 SELECT r.src, r.dst FROM r;
+DELETE FROM r;
 --
 +-----------+-----------+
 |src        |dst        |
 +-----------+-----------+
+|          0|          0|
+|          1|          5|
 +-----------+-----------+
 ==
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/77287a78/query_optimizer/rules/EliminateEmptyNode.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/rules/EliminateEmptyNode.cpp b/query_optimizer/rules/EliminateEmptyNode.cpp
index 03e6f33..c025ebf 100644
--- a/query_optimizer/rules/EliminateEmptyNode.cpp
+++ b/query_optimizer/rules/EliminateEmptyNode.cpp
@@ -208,12 +208,21 @@ P::PhysicalPtr Apply(const P::PhysicalPtr &node) {
   for (const auto &child : new_node->children()) {
     const auto new_child = Apply(child);
     if (new_child == nullptr) {
-      if (P::SomeUnionAll::Matches(node)) {
-        has_changed_children = true;
-        continue;
+      switch (node->getPhysicalType()) {
+        case P::PhysicalType::kUnionAll:
+          has_changed_children = true;
+          break;
+        case P::PhysicalType::kInsertSelection:
+          if (!new_children.empty()) {
+            // The actual input is empty.
+            return nullptr;
+          }
+          new_children.push_back(child);
+          break;
+        default:
+          return nullptr;
       }
-
-      return nullptr;
+      continue;
     } else if (child != new_child && !has_changed_children) {
       has_changed_children = true;
     }


Mime
View raw message