Skip to content
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 initial Arrow PyCapsule support #517

Merged
merged 23 commits into from
Oct 15, 2024
Merged

Add initial Arrow PyCapsule support #517

merged 23 commits into from
Oct 15, 2024

Conversation

jonmmease
Copy link
Collaborator

@jonmmease jonmmease commented Oct 12, 2024

Supersedes #501 now that everything needed has been updated.

Adopts arro3 / pyo3-arrow / narwhals for managing DataFrames in Python and the passing to Rust in arrow format with zero copy.

Uses get_column_usage to determine which columns are needed for each input inline dataset, and then uses narwhals to downproject prior to wrapping in an arro3 table to pass to rust. This approach removes the need for the Python data source framework, so I removed this all together.

Performance of this workflow is improved from prior handling of pandas/polars, and is faster than the duckdb code path in my limited testing. We'll want to do more comprehensive benchmarks before release.

for i in range(20):
# Break cache by removing one row each iteration
movies_inner = movies.iloc[i:]
movies["Title"] = movies["Title"].astype(str)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wish polars/pyarrow could handle loading mixed str/num columns from pandas

func: Arc::new((*STR_TO_UTC_TIMESTAMP_UDF).clone()),
args: vec![field_col, lit(default_input_tz)],
})
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure there are a lot more of these that will need to be updated, but just did this one to get tests passing

@jonmmease jonmmease merged commit 12e6d97 into v2 Oct 15, 2024
19 checks passed
jonmmease added a commit that referenced this pull request Nov 16, 2024
* Add initial Arrow PyCapsule support

* Bump python in actions to 3.11

* fmt

* update hang test to use polars with pycapsule path

* Add system python of 3.11

* Add more efficient hashing and rechunk for DataFusion

* fmt

* use narwhals to remove unused columns.

* toward removing arrow/pyarrow flag

* Remove arrow-rs pyarrow flag, use pyo3-arrow

* Rename pyarrow feature flag to `py`

* toward using narwhals to process transformed data

* Remove python datasource

* Handle dict and non-narwhals pycapsule types

* update default extraction to arro3

* fix type checking

* build py before type checking

* skip empty fields in window transform

* Try normalize category order

* lower min Python back to 3.9

* clear wheel build dir first

* try rename artifacts

* cache?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant