-
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
Add DynamicFilter#isAwaitable method #5043
Conversation
sopel39
commented
Sep 1, 2020
•
edited
Loading
edited
97bd7a2
to
28756a6
Compare
presto-main/src/main/java/io/prestosql/server/DynamicFilterService.java
Outdated
Show resolved
Hide resolved
Maybe we need a tri-state logic for this? |
I thought about it. However, let's say that you obtain info that DF is not complete yet, but you have no means to block while waiting for it. Then the only mean to wait for it would be via active loop. Additionally, we want/will be supporting laziness for most DFs (replicated, re-partitioned) with exception for large replicated DFs, which should be rarity (and repartition joins too) |
That's up to connector to decide what they do. Even if we do not consider these as viable options today, I am generally concerned about removing factually incorrect information from the API. If you do not like tri-state, maybe let's rename the method |
It can still do that via Perhaps, we should give that knowledge to connector, but not part of this PR.
I could do that. It's a change in relatively fresh SPI though, which i think is fine |
28756a6
to
3bae548
Compare
@findepi ac |
3bae548
to
f79264e
Compare
@Override | ||
public synchronized boolean isAwaitable() | ||
{ | ||
return futuresLeft > 0; |
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.
or !isBlocked.isDone()
?
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.
isBlocked
will unblock when DF is narrowed down partially, but DF is still awaitable
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.
Yes, but then new isBlocked
should be created, right?
So, in every moment current value of isBlocked.isBlocked()
could be used here -- am i right?
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.
Yes, but then new isBlocked should be created, right?
Ah, right. Although futuresLeft > 0;
seems more explicit
presto-spi/src/main/java/io/prestosql/spi/connector/DynamicFilter.java
Outdated
Show resolved
Hide resolved
presto-tests/src/test/java/io/prestosql/execution/TestLazyCoordinatorDynamicFiltering.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/server/DynamicFilterService.java
Outdated
Show resolved
Hide resolved
DynamicFilter#isAwaitable method can be used together with DynamicFilter#isBlocked to wait for narrowed dynamic filters. Some dynamic filters cannot be waited for (e.g for replicated joins). Therefore existing DynamicFilter#isComplete method cannot be used to determine if one can still wait for dynamic filter to be narrowed (isComplete could return false while isBlocked would return completed future immediatelly).
f79264e
to
c2bba56
Compare
Thanks, @findepi |