Skip to content

Add the predicate in physical plan explain output - #22984

Merged
rapids-bot[bot] merged 3 commits into
NVIDIA:mainfrom
Matt711:imp/polars/conditional-join-explain
Jun 25, 2026
Merged

Add the predicate in physical plan explain output#22984
rapids-bot[bot] merged 3 commits into
NVIDIA:mainfrom
Matt711:imp/polars/conditional-join-explain

Conversation

@Matt711

@Matt711 Matt711 commented Jun 25, 2026

Copy link
Copy Markdown
Member

Description

Includes the predicate in the physical plan explain output for ConditionalJoin, Filter, and Scan. Purely an improvement; helps make studying plan easier.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@Matt711
Matt711 requested a review from a team as a code owner June 25, 2026 15:26
@Matt711
Matt711 requested a review from rjzamora June 25, 2026 15:26
@Matt711 Matt711 added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Jun 25, 2026
@github-actions github-actions Bot added Python Affects Python cuDF API. cudf-polars Issues specific to cudf-polars labels Jun 25, 2026
@GPUtester GPUtester moved this to In Progress in cuDF Python Jun 25, 2026
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 8a38efe7-0501-4060-b494-6fa223685a18

📥 Commits

Reviewing files that changed from the base of the PR and between 14e9e9c and 46e219d.

📒 Files selected for processing (2)
  • python/cudf_polars/cudf_polars/streaming/explain.py
  • python/cudf_polars/tests/streaming/test_explain.py

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Explain output now shows filter, scan, and conditional join predicates in a clearer, human-readable format.
    • Structured expression output now preserves more readable predicate representations.
  • Tests

    • Added coverage for predicate formatting, including simple comparisons and nested logical expressions.
    • Added explain-plan coverage for conditional joins, including warning and output verification.

Walkthrough

The streaming explain formatter now renders predicates for conditional joins, filters, and scans, and the serializer matches Col and Literal directly. Tests cover predicate string formatting and conditional join explain output.

Changes

Streaming explain predicate rendering

Layer / File(s) Summary
Predicate formatting and explain headers
python/cudf_polars/cudf_polars/streaming/explain.py
Adds predicate string rendering for expression nodes, includes predicates in ConditionalJoin and Filter headers, extends Scan labels with scan predicates, and updates expression serialization to match Col and Literal directly.
Predicate rendering tests
python/cudf_polars/tests/streaming/test_explain.py
Adds coverage for _predicate_to_str on columns, binary comparisons, and nested logical expressions, and checks conditional join explain output with the rendered predicate and warning.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding predicate details to physical plan explain output.
Description check ✅ Passed The description matches the implemented changes and accurately describes the updated explain output and tests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

Comment on lines +267 to +276
_BinaryOperator.EQUAL: "==",
_BinaryOperator.NOT_EQUAL: "!=",
_BinaryOperator.LESS: "<",
_BinaryOperator.LESS_EQUAL: "<=",
_BinaryOperator.GREATER: ">",
_BinaryOperator.GREATER_EQUAL: ">=",
_BinaryOperator.LOGICAL_AND: "&",
_BinaryOperator.NULL_LOGICAL_AND: "&",
_BinaryOperator.LOGICAL_OR: "|",
_BinaryOperator.NULL_LOGICAL_OR: "|",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

optional: Would be cool to make e.g. str(plc.binaryop.BinaryOperator.EQUAL) return "==".

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, it does look nice. But I wonder if it's important not to lose the information already provided like that it's a value from an enum?

In [4]: str(plc.binaryop.BinaryOperator.EQUAL)
Out[4]: '<binary_operator.EQUAL: 21>'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Making __repr__ preserve this information while __str__ representing the symbolic version of the comparison could be a distinction (IIRC I think e.g. operator.eq does something similar), but overall NBD

@Matt711

Matt711 commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

/merge

@rapids-bot
rapids-bot Bot merged commit 69dc079 into NVIDIA:main Jun 25, 2026
110 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in cuDF Python Jun 25, 2026
galipremsagar pushed a commit to galipremsagar/cudf that referenced this pull request Jun 29, 2026
Includes the predicate in the physical plan explain output for `ConditionalJoin`, `Filter`, and `Scan`. Purely an improvement; helps make studying plan easier.

Authors:
  - Matthew Murray (https://github.com/Matt711)

Approvers:
  - Matthew Roeschke (https://github.com/mroeschke)

URL: NVIDIA#22984
rapids-bot Bot pushed a commit that referenced this pull request Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cudf-polars Issues specific to cudf-polars improvement Improvement / enhancement to an existing function non-breaking Non-breaking change Python Affects Python cuDF API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants