Skip to content

fix(core): handle null candidate in sqlite json contains simulation - #1298

Merged
AlessandroPomponio merged 1 commit into
mainfrom
ap_1297_handle_null_candidates_in_sqlite_json_contains
Jul 28, 2026
Merged

fix(core): handle null candidate in sqlite json contains simulation#1298
AlessandroPomponio merged 1 commit into
mainfrom
ap_1297_handle_null_candidates_in_sqlite_json_contains

Conversation

@AlessandroPomponio

@AlessandroPomponio AlessandroPomponio commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes a bug in the SQLite fallback for JSON_CONTAINS where filtering by a null value would return no results instead of matching rows where the field is explicitly null or absent entirely.

High-level Changes

  • ado/metastore/sql/statements.py: Added a short-circuit in simulate_json_contains_on_sqlite to handle null candidates. When the candidate is null, the function now emits a simpler json_extract(...) IS NULL query instead of delegating to json_tree-based subqueries (which only emit rows for fields that exist and would therefore never match missing or null fields).
  • tests/metastore/test_sql_utils.py: Added an integration test that creates an in-memory SQLite database with three rows — one with an explicit null field, one with the field missing entirely, and one with a real value — and asserts that filtering by null returns only the first two rows.

Impact

Queries that filter metastore resources by a null metadata field now return the correct results on SQLite. No changes to the public API or database schema; the fix is internal to the SQLite JSON-contains simulation logic.


AI Disclosure

The code and this PR description were generated using IBM Bob and reviewed manually.

Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
@AlessandroPomponio AlessandroPomponio added the ci Enables CI integration label Jul 28, 2026
@AlessandroPomponio
AlessandroPomponio added this pull request to the merge queue Jul 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 28, 2026
@AlessandroPomponio
AlessandroPomponio added this pull request to the merge queue Jul 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 28, 2026
@AlessandroPomponio
AlessandroPomponio added this pull request to the merge queue Jul 28, 2026
Merged via the queue into main with commit 1576af9 Jul 28, 2026
18 checks passed
@AlessandroPomponio
AlessandroPomponio deleted the ap_1297_handle_null_candidates_in_sqlite_json_contains branch July 28, 2026 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Enables CI integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(core): filtering resources by null does not match absent JSON fields on SQLite

2 participants