Skip to content
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

Don't estimate OPTIONAL_JOIN size as 0 fixes #108 #110

Merged
merged 2 commits into from Aug 24, 2018
Merged

Don't estimate OPTIONAL_JOIN size as 0 fixes #108 #110

merged 2 commits into from Aug 24, 2018

Conversation

niklas88
Copy link
Member

When the OPTIONAL_JOIN has a an empty side it would estimate it's result
as empty. For estimates of size zero JOIN would then take the estimate
as exact and stop early.

The current fix is just incrementing the size estimate by one to make
sure it's never 0. @floriankramer do you know in which cases we are sure
that the size will be 0? Also I'm really not happy with getKnownEmpty()
being just a check for getSizeEstimate() == 0 an estimate should
probably not be used as known even if it's exactly 0.

While we are here also remove redundant getRootOperation() calls in
Join.cpp (getResult() already uses the _rootOperation) and add some
useful LOG(TRACE)

When the OPTIONAL_JOIN has a an empty side it would estimate it's result
as empty. For estimates of size zero JOIN would then take the estimate
as exact and stop early.

The current fix is just incrementing the size estimate by one to make
sure it's never 0. In the future we may want to get an exact estimate
for 0.

While we are here also remove redundant `getRootOperation()` calls in
Join.cpp (`getResult()` already uses the `_rootOperation`) and add some
useful `LOG(TRACE)`
@niklas88 niklas88 requested review from Buchhold, floriankramer and joka921 and removed request for floriankramer August 21, 2018 16:23
Copy link
Member

@joka921 joka921 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good.
Just one thought: Do you always use std::endl which always performs a flush? This is good before lengthy computations but bad if there is a lot of output. I think this does not make a difference with our system, but I just wanted to make sure that this is done on purpose

@@ -327,6 +327,8 @@ void OptionalJoin::computeSizeEstimateAndMultiplicities() {
} else {
_sizeEstimate = multResult * numDistinctResult;
}
// Don't estimate 0 since then upstream thinks we are sure it's zero
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is "upstream" a fixed term in the QLever engine, or what is its meaning here?

Copy link
Member Author

@niklas88 niklas88 Aug 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, with it I mean in the parents of this node in the QueryExecutionTree. Particularly in Join when it checks for isKnownEmpty().

@niklas88
Copy link
Member Author

You are right about std::endl, the idea for debug messages is that it makes sure we get the output if it crashes immediately afterwards

@niklas88 niklas88 merged commit 5b7dfc6 into ad-freiburg:master Aug 24, 2018
@niklas88 niklas88 deleted the fix_optional branch October 31, 2018 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants