-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat(rust): Expose IRFunctionExpr::DynamicPred in the python visitor
#27616
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
question: where does the predicate that one must evaluate actually live? It seems like it's in
pred.predbut that is not exposed anywhere. I'm also not sure it can be because it's anArc<dyn PredicateExpr>?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.
The predicate is simple in this case. For example,
col < threshold(top_k) which we know from thesortorder.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.
Is this something that should be exposed? I don't think the predicate can be called. In this case the predicate is simple, but that doesn't seem like a guarantee.
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 think we could reconstruct the filter (even for complex predicates) because the unique id lets us match each
dynamic_predto its parent sort-slice. But I would want to avoid this manual reconstruction if possible.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 read through @ritchie46's PR but I think I didn't fully understand the structure of how these things are matched up.
IIUC, we have something like:
That produces:
And so the idea here is that you're going to read
dfin chunks and apply the filter based on things you've already seen. So you read the first chunk, the predicate initially return true until you've "filled up" your slice. Then the next time the predicate runs on the next chunk, it delivers values if they are less than the max in the filled up slice, and so forth.OK, in that scenario I can see how we can have an expression for the predicate.
But what about (it's not implemented yet) if there was a transformation like:
That produced:
Where in this case the dynamic_predicate is set membership of the already seen values.
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.
Indeed. That's how it might be used as well. Another thing we plan to use it for is members of the hash-table in a join. But this is something that will dynamically at runtime be determined. Not something we can statically make a predicate for. Otherwise we would have done that already. :)
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.
OK so the
idis sufficient today to reconstruct the predicate. But as you all said we could set membership or members for the hash table for a join. We could (TODO) tag the predicate with a description (eg.TopK,UniqueMembership,JoinMembership)?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 think it should be tagged. The
idshould be sufficient. You would find a dynamicpredicate withid=xin a scan and then the dynamicpredicate setting withid=xin a different IR node. The IR node would indicate what to do. How that is done is left to the implementation.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.
Ok cool. I bumped the IR version in 8fcf646. Also gentle reminder about adding me as a code owner for the visitor in the PR description.