-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix handling of OPTIONAL
with empty or unconnected patterns
#1847
base: master
Are you sure you want to change the base?
Fix handling of OPTIONAL
with empty or unconnected patterns
#1847
Conversation
src/engine/NeutralOptional.cpp
Outdated
size_t NeutralOptional::getCostEstimate() { | ||
// Cloning is expensive, so we estimate the cost as the cost of the child. | ||
// Does not apply to the lazy case. | ||
return std::max<size_t>(tree_->getCostEstimate(), 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is the right thing to do here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the comment about the cloning etc.
There also is nothing to clone here?
And like this, the operation is free, as the cost estimate always has to include the costs for the children.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1847 +/- ##
==========================================
+ Coverage 90.20% 90.24% +0.03%
==========================================
Files 400 401 +1
Lines 38514 38616 +102
Branches 4319 4330 +11
==========================================
+ Hits 34743 34850 +107
+ Misses 2477 2473 -4
+ Partials 1294 1293 -1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much,
I have some questions and suggestions.
Please start commenting your code (docstrings + non-obvious code parts)
src/engine/NeutralOptional.cpp
Outdated
size_t NeutralOptional::getCostEstimate() { | ||
// Cloning is expensive, so we estimate the cost as the cost of the child. | ||
// Does not apply to the lazy case. | ||
return std::max<size_t>(tree_->getCostEstimate(), 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the comment about the cloning etc.
There also is nothing to clone here?
And like this, the operation is free, as the cost estimate always has to include the costs for the children.
…mpty-pattern-planning
Conformance check passed ✅No test result changes. |
|
Fixes #1761, by ensuring that the
OPTIONAL
clause will always return at least a single value, so the cartesian product will never be empty.