Minor fix in EliminateEmptyNode.
diff --git a/query_optimizer/rules/EliminateEmptyNode.cpp b/query_optimizer/rules/EliminateEmptyNode.cpp
index c025ebf..fd1c383 100644
--- a/query_optimizer/rules/EliminateEmptyNode.cpp
+++ b/query_optimizer/rules/EliminateEmptyNode.cpp
@@ -328,6 +328,15 @@
}
}
+ auto output = Apply(plan);
+ if (output == plan) {
+ return input;
+ }
+
+ if (output) {
+ return input->copyWithNewChildren({output});
+ }
+
#ifdef QUICKSTEP_DEBUG
{
CHECK(!project_expressions.empty());
@@ -341,15 +350,6 @@
}
#endif
- auto output = Apply(plan);
- if (output == plan) {
- return input;
- }
-
- if (output) {
- return input->copyWithNewChildren({output});
- }
-
auto catalog_relation = std::make_unique<CatalogRelation>(
catalog_database_, GetNewRelationName(catalog_database_->size()), -1, true);