Skip to content

Commit b4a85b6

Browse files
committed
Fixed cardinality mistake for invariant booleans
1 parent 01c64fe commit b4a85b6

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/jrd/recsrc/FilteredStream.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,13 @@ FilteredStream::FilteredStream(CompilerScratch* csb, RecordSource* next,
5050

5151
m_impure = csb->allocImpure<Impure>();
5252

53-
const auto cardinality = next->getCardinality();
54-
Optimizer::adjustSelectivity(selectivity, MAXIMUM_SELECTIVITY, cardinality);
55-
m_cardinality = cardinality * selectivity;
53+
auto cardinality = next->getCardinality();
54+
if (selectivity)
55+
{
56+
Optimizer::adjustSelectivity(selectivity, MAXIMUM_SELECTIVITY, cardinality);
57+
cardinality *= selectivity;
58+
}
59+
m_cardinality = cardinality;
5660
}
5761

5862
void FilteredStream::internalOpen(thread_db* tdbb) const

src/jrd/recsrc/RecordSource.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ namespace Jrd
575575
{
576576
public:
577577
FilteredStream(CompilerScratch* csb, RecordSource* next,
578-
BoolExprNode* boolean, double selectivity);
578+
BoolExprNode* boolean, double selectivity = 0);
579579

580580
void close(thread_db* tdbb) const override;
581581

@@ -623,7 +623,7 @@ namespace Jrd
623623
public:
624624
PreFilteredStream(CompilerScratch* csb, RecordSource* next,
625625
BoolExprNode* boolean)
626-
: FilteredStream(csb, next, boolean, next->getCardinality())
626+
: FilteredStream(csb, next, boolean)
627627
{
628628
m_invariant = true;
629629
}

0 commit comments

Comments
 (0)