Skip to content

Fix conditional outer join root predicates [databricks] - #16109

Merged
nartal1 merged 1 commit into
NVIDIA:mainfrom
nartal1:outer-join-bug
Sep 27, 2026
Merged

nartal1 merged 1 commit into
NVIDIA:mainfrom
nartal1:outer-join-bug

Conversation

@nartal1

@nartal1 nartal1 commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #16067.

Description

Conditional right outer joins can fail with The expression must produce a boolean output, while conditional full outer joins can return incorrect results when the remaining condition is a root GpuBoundReference.

For BuildLeft, LazyCompiledCondition reorders the AST inputs but previously remapped only child expressions, leaving a root reference bound to the wrong column. This change remaps the root reference before recursively transforming its children.

CPU/GPU regression tests cover right and full outer joins with the AUTO, HASH_ONLY, and INNER_SORT_WITH_POST strategies.

Performance testing is not required because this changes only one-time AST condition rebinding and adds no row or batch hot-path work.

AI assistance disclosure: Codex assisted with issue implementation and validation. It was reviewed by the author before publication.

Checklists

Documentation

  • Updated for new or modified user-facing features or behaviors
  • No user-facing change

Testing

  • Added or modified tests to cover new code paths
  • Covered by existing tests
    (Please provide the names of the existing tests in the PR description.)
  • Not required

Performance

  • Tests ran and results are added in the PR description
  • Issue filed with a link in the PR description
  • Not required

Signed-off-by: Niranjan Artal <nartal@nvidia.com>
@nartal1 nartal1 self-assigned this Sep 23, 2026
@nartal1 nartal1 added the bug Something isn't working label Sep 23, 2026
@greptile-apps

greptile-apps Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no actionable correctness, security, test-quality, or performance issue remains.

Summary

This PR fixes BuildLeft conditional-join AST rebinding by remapping a root GpuBoundReference before recursively transforming child expressions.

  • Preserves the established left ++ right to right ++ left ordinal mapping.
  • Adds CPU/GPU parity coverage for conditional right and full outer joins.
  • Exercises AUTO, HASH_ONLY, and INNER_SORT_WITH_POST strategies while requiring the intended GPU join operators.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Condition bound to left then right columns] --> B{Build side}
  B -->|BuildRight| C[Compile with left columns first]
  B -->|BuildLeft| D[Remap every bound reference including root]
  D --> E[Compile with right columns first]
  C --> F[Cached compiled AST]
  E --> F
  F --> G[Conditional GPU join]
Loading

Reviews (1) · Last reviewed commit: "Fix root join condition rebinding"

@nartal1
nartal1 requested a review from a team September 23, 2026 23:10
@nartal1

nartal1 commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator Author

build

1 similar comment
@nartal1

nartal1 commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator Author

build

@gerashegalov gerashegalov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@sameerz

sameerz commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator

build

@nartal1
nartal1 merged commit da56bd0 into NVIDIA:main Sep 27, 2026
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Conditional right outer join fails with non-boolean AST

3 participants