-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Leverage Block#mayHaveNull() in HashSemiJoinOperator #8639
Leverage Block#mayHaveNull() in HashSemiJoinOperator #8639
Conversation
Could you please add JMH benchmark results before and after the change showing the improvement ? |
It's going to take some time to put that together since no JMH benchmark exists for Before:
After:
Logically, these changes here are extending the pattern of using |
I think it would be nice to add a JMH benchmark if one doesn't exist while making such optimizations. The linked PR doesn't have JMH numbers either. |
I chose to leave the loop unswitching decision up to the C2 JIT instead of manually unswitching the loops here because a manually unswitched version would probably want variants for
I agree, but on my end its been a question of available time and the effort required to produce meaningful benchmarks. In the case of the |
core/trino-main/src/main/java/io/trino/operator/HashSemiJoinOperator.java
Outdated
Show resolved
Hide resolved
|
||
// update hashing strategy to use probe cursor | ||
for (int position = 0; position < inputPage.getPositionCount(); position++) { | ||
if (probeJoinPage.getBlock(0).isNull(position)) { | ||
if (probeJoinNulls != null && probeJoinNulls.isNull(position)) { |
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.
How about using a boolean variable like probeJoinCanBeNull instead of null in probeJoinNulls?
The code would be more explicit.
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.
You could, but then you'd need a boolean probeJoinCanBeNull
and Block probeJoinNulls
which doesn't seem like an improvement in clarity.
4b90f8e
to
e1deae9
Compare
e1deae9
to
f4cb08a
Compare
Renamed |
Comparable changes to prestodb/presto#16459
Consults
Block#mayHaveNull()
outside of the main processing loop inHashSemiJoinOperator
so thatBlock#isNull
checks can be skipped inside the loop when none are necessary.Also adds:
LazyBlock#mayHaveNull()
implementation to make theBlock#mayHaveNull()
checks like this one more effectivePage#getLoadedPage(int... columns)
helper methods to support simultaneous column extraction andLazyBlock
unwrapping