-
Notifications
You must be signed in to change notification settings - Fork 60
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
First pass on IN/Not In #270
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
64f7a52
First pass on IN/Not In
hntd187 75a6a3a
In/Not In support for String Arrays and more tests
hntd187 7cb6c45
chore: fmt
hntd187 5be298c
Update kernel/src/engine/arrow_expression.rs
hntd187 0ddcbdf
Merge branch 'main' into in-not-in
hntd187 4a715b2
Address PR feedback
hntd187 bbcbc46
Address PR feedback
hntd187 ae17592
Address PR feedback
hntd187 9de1edc
Merge branch 'main' into in-not-in
hntd187 d7ca9d8
Address PR feedback
hntd187 a03b4fe
Address PR feedback, use dangling pointer for init/empty array instea…
hntd187 36d7b9a
Merge branch 'main' into in-not-in
hntd187 9abd4bc
Merge branch 'main' into in-not-in
hntd187 ff28e09
Merge remote-tracking branch 'mine/in-not-in' into in-not-in
hntd187 0309334
Address PR feedback, as well as resolve some lints and nightly build …
hntd187 ad9ca08
Fix failing test in ffi
hntd187 e2eda49
Updated a test to remove arrow deps
hntd187 52bfc0b
Merge branch 'main' into in-not-in
hntd187 5c968d9
Merge remote-tracking branch 'origin/main' into in-not-in
hntd187 e1fd8f6
Merge branch 'main' into in-not-in
hntd187 b12f8d6
Merge remote-tracking branch 'mine/in-not-in' into in-not-in
hntd187 1c079d9
Added a guard and a test for when the right side column comparison fo…
hntd187 0866f35
Added a test for literal array comparisons
hntd187 112fdf7
chore: fmt
hntd187 ec07f07
added a test for invalid cases and tighten a match arm to not match o…
hntd187 e752ae3
added a test for invalid cases and tighten a match arm to not match o…
hntd187 677581a
Merge remote-tracking branch 'mine/in-not-in' into in-not-in
hntd187 444b1dc
chore:fmt
hntd187 a69a95b
Merge branch 'main' into in-not-in
hntd187 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 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 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 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 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 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.
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.
I'm not 100% confident I understand what this code is doing but:
It looks like we need to replicate an "array scalar" value into an arrow array suitable for comparing against a batch of primitive values, right? So e.g. if I had
x in (1, 2, 3)
thenvalues
would be[1, 2, 3]
and we need to explode that into[[1, 2, 3], [1, 2, 3], ..., [1, 2, 3]]
so that the eventualevaluate_expression
call can invoke e.g. in_list? The documentation for that function is sorely incomplete, but I guess it's marching element by element through two arrays, producing a true output element each row whose list array element contains the corresponding primitive array element? That would be general enough to handle a correlated subquery, but would be quite space-inefficient for the common case (literal in-list or uncorrelated subquery) where we compare against the same array in every row -- especially in case said array is large.Does arrow rust provide a "scalar" version of
in_list
that takes two primitive arrays instead? So that e.g.scalar_in_list([1, 2, 3, 4, 5, 6], [1, 3, 5])
returns[true, false, true, false, true, false]
?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 are correct, go through and build the offsets. This approach was actually heavily inspired from how datafusion does this, so while I agree a very large list likely doesn't have great performance there isn't (to my current knowledge) a more idiomatic way to accomplish this. I generally dislike working with the list types in arrow, but to my knowledge arrow does not provide a scalar version of it. You would have to replicate the static value N number of times for each row. Primitive array, Generic string array on the left and list array on the 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.
I mean we should really build+probe a hash table for all but the smallest in-lists, to avoid paying
O(n**2)
work. It would likely pay for itself for any query that has more than about 100 rows (and smaller queries would run so fast who cares).If arrow doesn't give a way to do that maybe we need to do it ourselves?
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.
Update: the hash table thing gets pretty clearly into engine territory, so if we can figure out how to offload the optimization to engine [data], that's probably better.
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.
We're already in engine territory here, since this is the expression evaluator. That said, I think we could make this better. See my comment below where we evaluate
IN