-
Notifications
You must be signed in to change notification settings - Fork 608
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
refactor(selectors): remove janky Predicate
class and unify Selector
s under a single interface
#9917
Merged
Conversation
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
cpcloud
added
internals
Issues or PRs related to ibis's internal APIs
refactor
Issues or PRs related to refactoring the codebase
labels
Aug 25, 2024
cpcloud
force-pushed
the
cleanup-selectors
branch
4 times, most recently
from
August 25, 2024 18:51
6bd0a97
to
fde885c
Compare
Since we benchmark selectors for the wide table case, I ran them, and there's a consistent 10% improvement. Nothing to write home about, but I'll take the win.
|
cpcloud
force-pushed
the
cleanup-selectors
branch
2 times, most recently
from
August 25, 2024 19:04
5478f1f
to
ce9d31d
Compare
cpcloud
commented
Aug 25, 2024
cpcloud
added
the
ci-run-cloud
Add this label to trigger a run of BigQuery, Snowflake, and Databricks backends in CI
label
Aug 25, 2024
ibis-docs-bot
bot
removed
the
ci-run-cloud
Add this label to trigger a run of BigQuery, Snowflake, and Databricks backends in CI
label
Aug 25, 2024
cpcloud
force-pushed
the
cleanup-selectors
branch
3 times, most recently
from
August 25, 2024 21:11
a170ef9
to
2fd8f0c
Compare
cpcloud
commented
Aug 26, 2024
jcrist
reviewed
Aug 26, 2024
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.
Overall this looks like a nice improvement!
cpcloud
force-pushed
the
cleanup-selectors
branch
from
August 26, 2024 14:19
0c2969e
to
7ba2411
Compare
cpcloud
force-pushed
the
cleanup-selectors
branch
from
August 26, 2024 15:05
e1dcfe3
to
c5b8e3a
Compare
jcrist
approved these changes
Aug 27, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of changes
This is a refactor of selectors internals.
The disparity between the
Predicate
class and theSelector
has alwaysbothered me, because not every selector can be easily made into a predicate.
And, for the ones that can, there are some often-used ones that are really
awkward to express as predicates, like the
c
selector, which expressed asa predicate led to performance problems and IMO unnecessarily complex solutions
to that performance problem.
I thought to myself, "What are selectors doing fundamentally?"
And the answer I came up with is that they are producing a sequence of column
names that can be used to subset columns in a table.
Set operations ended up being a much more natural way to model the problem, while
allowing subclasses of
Selector
to customize operations for whatever reasone.g., avoiding any overhead if there's a fast path (selecting no columns) or if
overriding is necessary for the functionality (e.g.,
And
).So, I turned
Predicate
intoWhere
, and rewrote a bunch of the selectorsthat were previously based on
where
into their own specialized classes, andboiled everything down to expanding the names of a selector based on an input
table, and rewrote the top-level
expand
method in terms of name expansion.Previously we were also incurring the overhead of table column selection in
every case, and for a good chunk of selectors, we can avoid that overhead by
computing directly on the table's columns.