fix: avoid linear objectHas scans for large inline imports - #1070
Merged
Conversation
Motivation: Large imported strict-JSON objects can use uncapped inline field arrays. PR databricks#1060 routes value lookups through a lazy map above the inline scan threshold, but objectHas/objectHasAll still used linear contains scans. Modification: Reuse Obj.InlineScanMax in containsKey, containsVisibleKey, and inline-object producers so large inline objects fall through to getValue0 while all inline thresholds share one source of truth. Add a bench regression that repeatedly calls objectHas/objectHasAll over imported JSON fields. Result: Keeps small inline-object scans while avoiding O(N^2) repeated membership checks on large imported JSON objects. References: databricks#1061
He-Pin
force-pushed
the
codex/pr1061-rework
branch
from
June 30, 2026 02:55
1342f67 to
0f177a9
Compare
He-Pin
marked this pull request as draft
June 30, 2026 03:22
He-Pin
marked this pull request as ready for review
June 30, 2026 04:35
stephenamar-db
approved these changes
Jun 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation:
PR #1061 was closed against the obsolete
fixjsonbase, but the issue still needs a clean PR on the current upstreammaster. PR #1060 added theInlineScanMaxfallback forvalueRaw, yet repeatedstd.objectHas/std.objectHasAllchecks over large imported strict-JSON objects still reachedcontainsVisibleKey/containsKeyand scanned uncapped inline field arrays. That kept membership-heavy workloads at O(N^2).Modification:
upstream/master(1db39dde).Obj.InlineScanMaxtoVal.Obj.containsKeyandVal.Obj.containsVisibleKey, so large inline objects fall through to the existing lazygetValue0LinkedHashMappath.Obj.InlineScanMaxin inline-object producers, keeping construction and lookup thresholds on one source of truth.std.objectHas/std.objectHasAllcalls over imported JSON object fields.Result:
masterstd.objectHas/std.objectHasAllover large imported JSON object fields97.942 ms/op21.117 ms/op4.64xfaster (-78%)Large inline imported objects now pay one lazy map build above the scan threshold, then reuse O(1) map probes for repeated membership checks. Small inline objects keep the cheap linear scan path.
References: