-
Notifications
You must be signed in to change notification settings - Fork 119
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
Conversion from pyarrow Expression
s to QueryBuilder
expressions
#2202
Open
IvoDD
wants to merge
3
commits into
master
Choose a base branch
from
parse-pyarrow-expression-strings
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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
8e51d61
to
9c7aa0f
Compare
Introduces `ExpressionNode.from_pyarrow_expression_str`. This is required for predicate pushdown integration with polars. E.g. when we do: ``` lf = polars.scan_arcticdb(arctic_identifier) lf = lf.filter(pl.col("float_col") <= 40.1) lf.collect() ``` When calling `collect` the filter will get pushed down to our (to be implemented) `polars.scan_arcticdb` via a callback. The filter is given as a string which can be evaluated to a pyarrow expression. For reference string construction happens [here](https://github.com/pola-rs/polars/blob/4e286d8c83b0fcb56f0a7ea06d2eb731f179e01e/crates/polars-plan/src/plans/python/pyarrow.rs#L25). I've decided to keep this conversion code in core arcticdb instead of polars for a few reasons: - Gives us more flexibility if we decide to update our `QueryBuilder` expressions - We'll have less code to maintain in a repository which is not ours - Automated tests allow us to not accidentally break polars predicate pushdown to arcticdb For additional reference see how pyiceberg handles predicate pushdown from polars [here](https://github.com/pola-rs/polars/blob/4e286d8c83b0fcb56f0a7ea06d2eb731f179e01e/py-polars/polars/io/iceberg.py#L197-L200) And how this might fit in the prototype `polars.scan_arcticdb` implementation [here](https://github.com/IvoDD/polars/pull/1/files)
9c7aa0f
to
cfe2c11
Compare
alexowens90
reviewed
Mar 3, 2025
alexowens90
reviewed
Mar 5, 2025
python/tests/unit/arcticdb/version_store/test_query_builder_parse_pyarrow.py
Show resolved
Hide resolved
alexowens90
reviewed
Mar 11, 2025
alexowens90
reviewed
Mar 11, 2025
alexowens90
reviewed
Mar 11, 2025
alexowens90
reviewed
Mar 11, 2025
alexowens90
reviewed
Mar 11, 2025
python/tests/unit/arcticdb/version_store/test_query_builder_parse_pyarrow.py
Outdated
Show resolved
Hide resolved
alexowens90
reviewed
Mar 11, 2025
python/tests/unit/arcticdb/version_store/test_query_builder_parse_pyarrow.py
Outdated
Show resolved
Hide resolved
Also adds ast.Set and ast.Tuple handling methods
alexowens90
approved these changes
Mar 12, 2025
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.
Reference Issues/PRs
Monday ref: 8471524478
What does this implement or fix?
Introduces
ExpressionNode._from_pyarrow_expression_str
.This is required for predicate pushdown integration with polars. E.g. when we do:
When calling
collect
the filter will get pushed down to our (to be implemented)polars.scan_arcticdb
via a callback. The filter is given as a string which can be evaluated to a pyarrow expression. For reference string construction happens here.I've decided to keep this conversion code in core arcticdb instead of polars for a few reasons:
QueryBuilder
expressionsFor additional reference see how pyiceberg handles predicate pushdown from polars here
And how this might fit in the prototype
polars.scan_arcticdb
implementation hereChange Type (Required)
Any other comments?
Checklist
Checklist for code changes...