8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 18:43:02 +01:00

Fixed cardinality mistake for invariant booleans

This commit is contained in:
Dmitry Yemanov 2024-11-12 19:26:52 +03:00
parent 01c64fe102
commit b4a85b61a7
2 changed files with 9 additions and 5 deletions

View File

@ -50,9 +50,13 @@ FilteredStream::FilteredStream(CompilerScratch* csb, RecordSource* next,
m_impure = csb->allocImpure<Impure>(); m_impure = csb->allocImpure<Impure>();
const auto cardinality = next->getCardinality(); auto cardinality = next->getCardinality();
Optimizer::adjustSelectivity(selectivity, MAXIMUM_SELECTIVITY, cardinality); if (selectivity)
m_cardinality = cardinality * selectivity; {
Optimizer::adjustSelectivity(selectivity, MAXIMUM_SELECTIVITY, cardinality);
cardinality *= selectivity;
}
m_cardinality = cardinality;
} }
void FilteredStream::internalOpen(thread_db* tdbb) const void FilteredStream::internalOpen(thread_db* tdbb) const

View File

@ -575,7 +575,7 @@ namespace Jrd
{ {
public: public:
FilteredStream(CompilerScratch* csb, RecordSource* next, FilteredStream(CompilerScratch* csb, RecordSource* next,
BoolExprNode* boolean, double selectivity); BoolExprNode* boolean, double selectivity = 0);
void close(thread_db* tdbb) const override; void close(thread_db* tdbb) const override;
@ -623,7 +623,7 @@ namespace Jrd
public: public:
PreFilteredStream(CompilerScratch* csb, RecordSource* next, PreFilteredStream(CompilerScratch* csb, RecordSource* next,
BoolExprNode* boolean) BoolExprNode* boolean)
: FilteredStream(csb, next, boolean, next->getCardinality()) : FilteredStream(csb, next, boolean)
{ {
m_invariant = true; m_invariant = true;
} }