review-cudf-polars-expressions
Skill9.8k starsChanged 4 months agoApache-2.0View on GitHub
Use when implementing or reviewing support for Polars Expressions in cudf-polars
Trending
Quiet since October.thin dataabout the whole repository
Who's talking about NVIDIA/cudf
- NVIDIA/cudf-spark-jni“[submodule-sync] bot-submodule-sync-main to main [skip ci] [bot]”GitHub · Oct 5, 2026 · 1 reactions
- NVIDIA/cudf-spark-jni“[submodule-sync] bot-submodule-sync-main to main [skip ci] [bot]”GitHub · Oct 4, 2026 · 1 reactions
- NVIDIA/cudf-spark-jni“[submodule-sync] bot-submodule-sync-main to main [skip ci] [bot]”GitHub · Oct 2, 2026 · 1 reactions
- NVIDIA/cudf-spark-jni“[submodule-sync] bot-submodule-sync-release/26.10 to release/26.10 [skip ci] [bot]”GitHub · Oct 1, 2026 · 1 reactions
- NVIDIA/cudf-spark-jni“[submodule-sync] bot-submodule-sync-main to main [skip ci] [bot]”GitHub · Oct 1, 2026 · 1 reactions
The biggest 5 of 9 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 9
Talked about on GitHub (9 times).
On GitHub · 9
- Oct 5, 2026[submodule-sync] bot-submodule-sync-main to main [skip ci] [bot] — NVIDIA/cudf-spark-jni1 reaction · 3 comments
- Oct 4, 2026[submodule-sync] bot-submodule-sync-main to main [skip ci] [bot] — NVIDIA/cudf-spark-jni1 reaction · 3 comments
- Oct 2, 2026[submodule-sync] bot-submodule-sync-main to main [skip ci] [bot] — NVIDIA/cudf-spark-jni1 reaction · 3 comments
- Oct 1, 2026[submodule-sync] bot-submodule-sync-release/26.10 to release/26.10 [skip ci] [bot] — NVIDIA/cudf-spark-jni1 reaction · 3 comments
- Oct 1, 2026[submodule-sync] bot-submodule-sync-main to main [skip ci] [bot] — NVIDIA/cudf-spark-jni1 reaction · 3 comments
4 more on GitHub
- Oct 1, 2026Seed pre-commit cache from main builds — rapidsai/cugraph-gnn1 reaction · 2 comments
- Oct 1, 2026[submodule-sync] bot-submodule-sync-main to main [skip ci] [bot] — NVIDIA/cudf-spark-jni1 reaction · 3 comments
- Sep 30, 2026[submodule-sync] bot-submodule-sync-main to main [skip ci] [bot] — NVIDIA/cudf-spark-jni1 reaction · 3 comments
- Sep 22, 2026Support cached broadcast semi/anti joins via reusable FilteredJoin [databricks] — NVIDIA/cudf-spark1 reaction · 5 comments
In this repository9 other files it gives its agents.
- build-test-cudf-javaSkill
- build-test-cudfSkill
- debug-cudf-pandasSkill
- perf-compare-cudfSkill
- reproduce-ciSkill
- review-cudfSkill
- update-narwhals-testingSkill
- accelerated-computing-cudfSkill
- cudf-query-engine-builderSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 5 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
If an expression cannot be supported or only partially supported (e.g.
- Distinctive: line 26
If you are unable to clone Polars, the Polars repository is located at https://github.com/pola-rs/polars.
- Distinctive: line 39
Ensure examples demonstrate a wide variety of behaviors given differing input data, including all applicable data types, missing values, …
- Distinctive: line 40
Ensure examples demonstrate when exceptions are raised given invalid input arguments.
- Very specific: line 46
Run the same examples generated in Step 1 with pl.GPUEngine(executor="streaming", raise_on_fail=True) passed to the engine argument of …
- Very specific: line 60
Start with scoping an implementation for the single partition path for cudf-polars.
- Very specific: line 66
Do not use any pylibcudf methods that are deprecated.
- Very specific: line 68
Do not use APIs that convert the data CPU objects like to_arrow or to_pylist unless absolutely necessary.
- Very specific: line 69
Ensure pylibcudf APIs calls are passed a stream object so they do not use their default stream argument.
- Very specific: line 70
Follow any additional guidance in python/REVIEW_GUIDELINES.md
- Very specific: line 71
When raising an exception to match Polars or to note that some functionality is not supported, prefer raising these exceptions in the …
- Very specific: line 72
Ensure the is_pointwise on the Expr subclass correctly reflects if the expression is a pointwise operation.
- Very specific: line 88
When using assert_gpu_result_equal for expressions that return floats, consider specifying check_exact=False if necessary.
- Distinctive: line 90
When running the unit tests:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Polars Expression implementation in cudf-polars
This rule describes guidelines and implementation patterns for supporting Polars' Expression Python APIs in cudf-polars. A successful implementation:
- Runs entirely on the GPU through cudf-polars and does not fall back to Polars on the CPU.
- If an expression cannot be supported or only partially supported (e.g. a parameter is unsupported), an error is raised during IR translation and not during runtime.
- The expression is supported for all Polars versions that cudf-polars supports specified in
python/cudf_polars/pyproject.toml - Passes all
pre-commitchecks.
Prerequisites
- Identify a suitable cudf-polars development environment, if not provided by the user, and ensure the Polars version is the latest supported version by cudf-polars.
- Identify a directory that contains the Polars source code to use as a reference for implementations. If it is not provided by the user or one cannot be identified, clone it to a temporary location. Ensure the Polars Git source tree is checked-out to the same Polars version installed in the development environment.
For example, to clone Polars matching the Polars version in a fictional, conda development environment named "cudf-dev"
POLARS_VERSION=$(conda run -n cudf-dev python -c "import polars as pl; print(pl.__version__)")
git clone https://github.com/pola-rs/polars.git --single-branch --branch py-$POLARS_VERSION /tmp/polarsIf you are unable to clone Polars, the Polars repository is located at https://github.com/pola-rs/polars.
Step 1: Understand the Polars expression implementation and behavior.
First, review the Polars implementation of the expression and understand its behavior without cudf-polars.
- The Python APIs for expressions are mostly defined in the
py-polars/src/polars/exprdirectory in a Polars repository. - Expressions are eventually exposed to cudf-polars in Rust in the
crates/polars-python/src/lazyframe/visitor/expr_nodes.rsfile in a Polars repository
Next, further understand the runtime behavior of the expressions by:
- Reviewing relevant tests in the
py-polars/testsdirectory that use the expression. - Generating examples locally with the expression(s)
- Ensure examples demonstrate a wide variety of behaviors given differing input data, including all applicable data types, missing values, and values that may introduce edge cases like 0 for numeric data.
- Ensure examples demonstrate when exceptions are raised given invalid input arguments. Understand if the exceptions are raised before expressions are evaluated and therefore might not reach cudf-polars versus exceptions that are raised during expression evaluation runtime.
Step 2: Understand the current Polars expression behavior with cudf-polars.
Now, review if the Polars expression is currently supported and correct with cudf-polars.
Run the same examples generated in Step 1 with pl.GPUEngine(executor="streaming", raise_on_fail=True) passed to the engine argument of collect so failures do not fall back to CPU Polars. If the example data was relatively small, this should test the single partition path of cudf-polars.
Additionally run another variation of the Step 1 examples with pl.GPUEngine(executor="streaming", raise_on_fail=True, executor_options={"max_rows_per_partition": 2}) passed to the engine argument of collect. With a large enough input data for the examples, this configuration would test the multiple partition path of cudf-polars.
Note the following failure and fallback cases:
- A failure might occur because an expression isn't exposed in Polars through
crates/polars-python/src/lazyframe/visitor/expr_nodes.rs. A fix therefore would be needed upstream in Polars in order to proceed with the next steps. - A failure might occur because an expression isn't supported in cudf-polars.
- An expression might not be implemented when run in the multiple partition path of cudf-polars and might fall back to the single partition path.
Step 3: Implement the Polars expression in cudf-polars.
Step 3a. Single Partition Implementation
Start with scoping an implementation for the single partition path for cudf-polars. This ensures that the multiple partition path can fall back to this implementation.
- An expression implementation should belong in the
python/cudf_polars/cudf_polars/dsl/expressionsdirectory. - Review the
pylibcudfAPI to find the appropriate function or functions needed for the implementation.- Additionally review the
libcudfpublic API as a function may be appropriate but not exposed throughpylibcudf. If needed, expose this API throughpylibcudfas part of the implementation.pylibcudfwill need to be rebuilt from source in order to test the implementation. - Minimize the amount of kernel launches by using specific
pylibcudffunctions where possible. Evaluate usingpylibcudf.expressionswhere sensible for combining several operations. - Do not use any
pylibcudfmethods that are deprecated. - Implement any short-circuiting opportunities by checking Column properties like the
null_countorsizethat minimizespylibcudfcalls. - Do not use APIs that convert the data CPU objects like
to_arroworto_pylistunless absolutely necessary. - Ensure
pylibcudfAPIs calls are passed a stream object so they do not use their default stream argument. - Follow any additional guidance in
python/REVIEW_GUIDELINES.md
- Additionally review the
- When raising an exception to match Polars or to note that some functionality is not supported, prefer raising these exceptions in the
__init__method instead of thedo_evaluatemethods of theExprsubclasses. - Ensure the
is_pointwiseon theExprsubclass correctly reflects if the expression is a pointwise operation.
Step 3b. Multiple Partition Implementation
Next, if the expression is non-pointwise, add a multiple partition implementation in python/cudf_polars/cudf_polars/streaming/expressions.py
TODO: Add more guidance on a multiple partition implementation.
Step 4: Test the Polars expression implementation in cudf-polars
Finally, add unit tests to an existing or new file in the python/cudf_polars/tests/expressions directory to test the implementation.
- The added unit tests should cover all the lines added in the implementation. A CI job validates that there is 100% code coverage.
- The unit tests should use the
enginefixture frompython/cudf_polars/tests/conftest.pyto test all applicable cudf-polars engine types including single and multiple partition execution. - Review the existing unit tests in
python/cudf_polars/teststo check if existing tests used this expressions. Unit tests may have existed that asserted that this expression was not supported. - The unit test should use
pytest.mark.skipifwith a boolean variable frompython/cudf_polars/cudf_polars/utils/versions.pyif a unit test exercises a Polars expression or an argument that doesn't exist since a particular Polars version within the cudf-polars support window defined inpython/cudf_polars/pyproject.toml. - When using
assert_gpu_result_equalfor expressions that return floats, consider specifyingcheck_exact=Falseif necessary.
When running the unit tests:
- First,
git stashthe new implementation (i.e. all changes not inpython/cudf_polars/tests) and only run the newly added tests to validate they fail without the new implementation. - Next,
git stash applythe stashed files and run all unit tests inpython/cudf_polars/tests. Address failures from the newly added tests or existing tests that fail because they use the Polars expressions being implemented.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

