Skip to content

Add UnsupportedOp for unsupported predicate sub-expressions - #983

Merged
chakankardb merged 2 commits into
mainfrom
abh_hierp
Jul 10, 2026
Merged

chakankardb merged 2 commits into
mainfrom
abh_hierp

Conversation

@chakankardb

@chakankardb chakankardb commented Jul 7, 2026 •

Copy link
Copy Markdown
Collaborator

Previously OpConverter threw IllegalArgumentException for unsupported SQL expressions (e.g. nested struct field access via GetStructField), causing the entire predicate to be dropped. This prevented pruning even when other parts of the predicate (e.g. AND siblings) were fully supported.

Instead, this change uses UnsupportedOp for unsupported sub-expressions, and then prunes away parts of expression tree based on them. This preserves the compound predicate structure so that supported siblings can still drive file pruning. UnsupportedOp evaluates conservatively to true (never prunes), which is propagated up via AND/OR/NOT. The UnsupportOp stays local to this client, and is never sent back to the server.

The change is guarded behind a flag.

@chakankardb
chakankardb force-pushed the abh_hierp branch 4 times, most recently from 579ff55 to 500668b Compare July 8, 2026 14:33
linzhou-db
linzhou-db previously approved these changes Jul 10, 2026

@charlenelyu-db charlenelyu-db 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

@chakankardb
chakankardb merged commit 420c3b3 into main Jul 10, 2026
5 checks passed
littlegrasscao added a commit that referenced this pull request Jul 22, 2026
)

* Add partial predicate filtering for unsupported sub-expressions

Co-authored-by: Isaac

* Log warning when sub-expression is replaced with UnsupportedOp

Co-authored-by: Isaac

Co-authored-by: Abhijit Chakankar <98838463+chakankardb@users.noreply.github.com>
murali-db pushed a commit to delta-io/delta that referenced this pull request Nov 17, 2026
â€Ķredicate hints (#8109)

#### Which Delta project/connector is this regarding?

- [ ] Spark
- [ ] Standalone
- [ ] Flink
- [ ] Kernel
- [x] Other (Sharing)

## Description

When a delta-format Delta Sharing query has one filter that can't be
converted to a json predicate (e.g. `RLIKE`/`LIKE`, or a large `IN`
list, which the optimizer turns into `InSet`), `OpConverter` throws. The
whole partition-filter or data-filter hint is then dropped, so the
sharing server can't skip any files and returns the full file list, even
though the other filters could have been used for skipping.

`DeltaSharingJsonPredicates.convert` now honors
`spark.delta.sharing.jsonPredicateHints.partialFilter.enabled`. That
conf, and partial conversion in `OpConverter`, shipped in
delta-sharing-client 1.4.1 (delta-io/delta-sharing#983), and the
parquet-format path (`RemoteDeltaFileIndex`) already uses them. When the
conf is on, `OpConverter` emits `UnsupportedOp` placeholders, and
`UnsupportedOpPruner` removes them before the hint is serialized:
- An AND keeps its supported children.
- An OR or NOT that contains an unsupported node is dropped whole.

So the hint still matches a superset of the files with matching rows,
and `UnsupportedOp` is never sent to the server. The conf applies to
both the partition and the data side of the hint. It defaults to
`false`, so behavior is unchanged unless it is enabled.

## How was this patch tested?

New `DeltaSharingFileIndexSuite` test "jsonPredicate partial filter
drops only unsupported sub-expressions". It pins the three hint confs
and asserts the exact json hint sent to the server:
- With the conf off, an unsupported `RLIKE` or a 21-value `IN` still
drops the whole data-filter side, as before.
- With the conf on:
- an unsupported AND conjunct (`RLIKE`, `InSet`, or a 21-value `IN`) is
dropped while the supported partition and data conjuncts are kept;
  - an OR containing an unsupported branch is dropped entirely;
  - a predicate with nothing supported sends no hint;
  - fully supported predicates produce the same hint as before.

Each check also asserts that exactly one file-listing call was made, so
a missing hint can't come from a cache hit.

## Does this PR introduce _any_ user-facing changes?

No. The behavior only changes when
`spark.delta.sharing.jsonPredicateHints.partialFilter.enabled` is set to
`true` (default `false`). With it on, queries with unsupported filters
can get server-side file skipping from their remaining filters.

This pull request and its description were written by Isaac.

---------

Signed-off-by: Abhijit Chakankar <abhijit.chakankar@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants