Skip to content

feat: support DataFusion Expr in DeleteBuilder#6343

Merged
wjones127 merged 1 commit into
lance-format:mainfrom
wjones127:feat/delete-expr
Apr 1, 2026
Merged

feat: support DataFusion Expr in DeleteBuilder#6343
wjones127 merged 1 commit into
lance-format:mainfrom
wjones127:feat/delete-expr

Conversation

@wjones127

@wjones127 wjones127 commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Previously, DeleteBuilder only accepted SQL string predicates. Callers who already had a datafusion::logical_expr::Expr (e.g. from query planning) had to serialize it to a string only for it to be reparsed inside.

This adds DeleteBuilder::from_expr(dataset, expr) as a companion to the existing DeleteBuilder::new(dataset, sql), following the dual-input pattern already used in Scanner (filter vs filter_expr). Internally both paths store an ExprFilter and dispatch to the appropriate scanner method. The Operation::Delete { predicate } field serializes the expr via expr.to_string() when needed for transaction logging.

Closes #6339

Test plan

  • New test_delete_with_expr_filter test verifies expr-based deletion matches the equivalent SQL path
  • All existing delete tests pass unchanged

Previously, `DeleteBuilder` only accepted SQL string predicates, requiring
callers who already had a `datafusion::logical_expr::Expr` to serialize it
to a string only for it to be reparsed internally.

This adds `DeleteBuilder::from_expr(dataset, expr)` as a companion to the
existing `DeleteBuilder::new(dataset, sql)`, following the same dual-input
pattern already used in `Scanner` (`filter` vs `filter_expr`). Internally
both paths store an `ExprFilter` and dispatch to the appropriate scanner
method; the `Operation::Delete { predicate }` field serializes the expr via
`expr.to_string()` when needed.

Closes lance-format#6339

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@github-actions github-actions Bot added the enhancement New feature or request label Mar 30, 2026
@wjones127
wjones127 marked this pull request as ready for review March 30, 2026 16:55
@codecov

codecov Bot commented Mar 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rust/lance/src/dataset/write/delete.rs 90.90% 2 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@Xuanwo Xuanwo 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.

Thank you!

@wjones127
wjones127 merged commit 932d4aa into lance-format:main Apr 1, 2026
32 of 34 checks passed
@yuvalif

yuvalif commented Apr 14, 2026

Copy link
Copy Markdown

@wjones127 thanks for the fix!
do you plan on adding this API to lancedb as well (lancedb/lancedb#3204) ?

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 row deletions

3 participants