From 4e813e0e37c8297a4710d06175857d96209287b6 Mon Sep 17 00:00:00 2001 From: Dmitry Yemanov Date: Sat, 2 Apr 2022 13:14:19 +0300 Subject: [PATCH] Fixed regression in outer joins --- src/jrd/optimizer/Optimizer.cpp | 10 ++++++---- src/jrd/optimizer/Optimizer.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/jrd/optimizer/Optimizer.cpp b/src/jrd/optimizer/Optimizer.cpp index aa1f55c31f..93045db59b 100644 --- a/src/jrd/optimizer/Optimizer.cpp +++ b/src/jrd/optimizer/Optimizer.cpp @@ -596,14 +596,16 @@ Optimizer::~Optimizer() // Compile and optimize a record selection expression into a set of record source blocks // -RecordSource* Optimizer::compile(RseNode* rse, BoolExprNodeStack* parentStack) +RecordSource* Optimizer::compile(RseNode* subRse, BoolExprNodeStack* parentStack) { - Optimizer subOpt(tdbb, csb, rse); + Optimizer subOpt(tdbb, csb, subRse); const auto rsb = subOpt.compile(parentStack); - if (parentStack) + if (parentStack && subOpt.isInnerJoin()) { - // If any parent conjunct was utilized, update our copy of its flags + // If any parent conjunct was utilized, update our copy of its flags. + // Currently used for inner joins only, although could also be applied + // to conjuncts utilized for outer streams of outer joins. for (auto subIter = subOpt.getParentConjuncts(); subIter.hasData(); ++subIter) { diff --git a/src/jrd/optimizer/Optimizer.h b/src/jrd/optimizer/Optimizer.h index 3ceb20c135..a7e44db850 100644 --- a/src/jrd/optimizer/Optimizer.h +++ b/src/jrd/optimizer/Optimizer.h @@ -372,7 +372,7 @@ public: ~Optimizer(); - RecordSource* compile(RseNode* rse, BoolExprNodeStack* parentStack); + RecordSource* compile(RseNode* subRse, BoolExprNodeStack* parentStack); void compileRelation(StreamType stream); void generateAggregateDistincts(MapNode* map); RecordSource* generateRetrieval(StreamType stream,