Skip to content

Commit 6c21404

Browse files
committed
Stricter conjunct distribution to RSEs, this fixes recent regressions
1 parent d72a7d9 commit 6c21404

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/jrd/RecordSourceNodes.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3456,6 +3456,9 @@ RecordSource* RseNode::compile(thread_db* tdbb, Optimizer* opt, bool innerSubStr
34563456

34573457
const auto csb = opt->getCompilerScratch();
34583458

3459+
StreamList rseStreams;
3460+
computeRseStreams(rseStreams);
3461+
34593462
BoolExprNodeStack conjunctStack;
34603463

34613464
// pass RseNode boolean only to inner substreams because join condition
@@ -3478,21 +3481,30 @@ RecordSource* RseNode::compile(thread_db* tdbb, Optimizer* opt, bool innerSubStr
34783481
{
34793482
// Push all conjuncts except "missing" ones (e.g. IS NULL)
34803483
for (auto iter = opt->getConjuncts(false, true); iter.hasData(); ++iter)
3481-
conjunctStack.push(iter);
3484+
{
3485+
if (iter->containsAnyStream(rseStreams))
3486+
conjunctStack.push(iter);
3487+
}
34823488
}
34833489
}
34843490
else
34853491
{
34863492
for (auto iter = opt->getConjuncts(); iter.hasData(); ++iter)
3487-
conjunctStack.push(iter);
3493+
{
3494+
if (iter->containsAnyStream(rseStreams))
3495+
conjunctStack.push(iter);
3496+
}
34883497
}
34893498

34903499
return opt->compile(this, &conjunctStack);
34913500
}
34923501

34933502
// Push only parent conjuncts to the outer stream
34943503
for (auto iter = opt->getConjuncts(true, false); iter.hasData(); ++iter)
3495-
conjunctStack.push(iter);
3504+
{
3505+
if (iter->containsAnyStream(rseStreams))
3506+
conjunctStack.push(iter);
3507+
}
34963508

34973509
return opt->compile(this, &conjunctStack);
34983510
}

src/jrd/optimizer/Optimizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ RecordSource* Optimizer::compile(BoolExprNodeStack* parentStack)
850850

851851
if (isInnerJoin())
852852
{
853-
for (auto iter = getBaseConjuncts(); iter.hasData(); ++iter)
853+
for (auto iter = getConjuncts(); iter.hasData(); ++iter)
854854
{
855855
if (!(iter & CONJUNCT_USED) &&
856856
iter->deterministic() &&

0 commit comments

Comments
 (0)