Skip to content

feat(rust): support datafusion expressions for merge insert predicates#6934

Open
Ar-maan05 wants to merge 1 commit into
lance-format:mainfrom
Ar-maan05:feat/merge-insert-expr-support
Open

feat(rust): support datafusion expressions for merge insert predicates#6934
Ar-maan05 wants to merge 1 commit into
lance-format:mainfrom
Ar-maan05:feat/merge-insert-expr-support

Conversation

@Ar-maan05
Copy link
Copy Markdown

@Ar-maan05 Ar-maan05 commented May 25, 2026

Description

This PR adds support for passing logical DataFusion expressions (datafusion_expr::Expr) directly to the merge insert query planner for conditional updates (WhenMatched::UpdateIfExpr). Currently, matched update predicates only accept SQL strings which are parsed at plan creation time, introducing serialize-deserialize round-trip overhead when callers build expressions programmatically.

Key Changes

  • WhenMatched Enum: Added the UpdateIfExpr(datafusion_expr::Expr) variant and the associated constructor helper WhenMatched::update_if_expr(expr: Expr).
  • Query Planner (merge_insert.rs): Updated plan generation to optimize the DataFusion logical expression and convert it directly to a physical expression.
  • Physical & Logical Layouts: Handled the new variant exhaustively in assign_action.rs (action determination), exec/write.rs (DisplayAs), and logical_plan.rs (Explain formatting).

Verification

  • Verified compile-safety and workspace formatting checks.
  • Verified via downstream integration tests in lancedb.

Closes #6861

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@github-actions github-actions Bot added the enhancement New feature or request label May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: support datafusion expression for merge insert predicates

1 participant