evalengine: disable the static IN hash table for JSON operands - #20691
Open
GrahamCampbell wants to merge 1 commit into
Open
evalengine: disable the static IN hash table for JSON operands#20691GrahamCampbell wants to merge 1 commit into
GrahamCampbell wants to merge 1 commit into
Conversation
GrahamCampbell
requested review from
arthurschreiber,
dbussink,
frouioui,
harshit-gangal,
mattlord and
systay
as code owners
July 25, 2026 11:32
Contributor
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
GrahamCampbell
marked this pull request as draft
July 25, 2026 11:40
GrahamCampbell
force-pushed
the
evalengine-json-in-static-table
branch
from
July 25, 2026 11:48
c2c2d94 to
d2f7ebb
Compare
This was referenced Jul 25, 2026
GrahamCampbell
force-pushed
the
evalengine-json-in-static-table
branch
3 times, most recently
from
July 25, 2026 13:24
d94d246 to
101fe8f
Compare
GrahamCampbell
force-pushed
the
evalengine-json-in-static-table
branch
from
July 27, 2026 19:48
101fe8f to
ba2ec8c
Compare
Collaborator
Author
|
@arthurschreiber This PR is now re-stacked to go in first, as you requested. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #20691 +/- ##
===========================================
+ Coverage 69.67% 86.24% +16.57%
===========================================
Files 1614 59 -1555
Lines 216793 15621 -201172
===========================================
- Hits 151044 13473 -137571
+ Misses 65749 2148 -63601
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Jul 27, 2026
GrahamCampbell
force-pushed
the
evalengine-json-in-static-table
branch
from
August 22, 2026 10:16
ba2ec8c to
68133dc
Compare
GrahamCampbell
force-pushed
the
evalengine-json-in-static-table
branch
from
August 24, 2026 12:43
68133dc to
02bb066
Compare
Signed-off-by: Graham Campbell <hello@gjcampbell.co.uk>
GrahamCampbell
force-pushed
the
evalengine-json-in-static-table
branch
from
August 28, 2026 18:40
02bb066 to
66c0fbd
Compare
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.
Description
The compiled IN fast path builds a static hash table from an all-literal list and treats a hash hit as equality without comparing the candidate. JSON values hash through their MySQL-style ordering weights, which fingerprint arrays and objects by kind and cardinality only, so any two arrays of the same length collide, as do any two objects with the same member count: with a JSON column containing
[1], the compiledjson_col IN (JSON_ARRAY(2))returns 1 where the interpreter and MySQL return 0. JSON operands now stay on the slow path, which performs real comparisons. The weight strings themselves are unchanged, since their shape is intentional for ordering; the defect was treating their hash as proof of equality.This leads the JSON chain, so the fast-path fix merges before anything widens its reach. At this position the compiler cannot yet push a constant-folded JSON literal, so an IN list over folded JSON documents fails to compile instead of building the table: it is pushed down to MySQL or evaluated by the interpreter where possible, and errors where a compiled program is required, which is the correct direction of failure; the test pins exactly that, and #20682 flips the same test to compiled evaluation once literal pushing exists.
Related Issue(s)
#20682 builds on this change.
Checklist
Deployment Notes
Compiled IN comparisons over JSON arrays and objects no longer report false matches for same-cardinality values. Until the follow-up JSON literal change lands, IN over a list of constant-folded JSON documents does not compile: it is pushed down to MySQL or evaluated by the interpreter where possible, and errors where a compiled program is required, instead of returning wrong matches. No migrations or configuration changes.
AI Disclosure
This PR was written primarily by Fable with review from GPT 5.6 Sol.
graph LR subgraph json [JSON support] direction TB PR20625["#20625 (merged)<br>mysql/json: fix MarshalTo discarding accumulated output for nested blob and bit values"] PR20632["#20632<br>vtgate: preserve IN value lists in complex aggregate projections"] PRA["#20691<br>evalengine: disable the static IN hash table for JSON operands"] PR20682["#20682 (draft)<br>evalengine: support constant-folded JSON values as literals"] PR20683["#20683 (draft)<br>evalengine, sqlparser: MySQL comparison domains; nested BETWEEN parentheses"] PR20626["#20626 (draft)<br>vtgate: support cross-shard JSON_ARRAYAGG and JSON_OBJECTAGG"] PR20625 --> PR20682 PRA --> PR20682 PR20682 --> PR20683 PR20632 --> PR20626 PR20683 --> PR20626 end subgraph union [Union routing] direction TB PR20628["#20628<br>vtgate: track per-source copies of pushed join predicates so merges skip them"] PR20629["#20629 (merged)<br>vtgate: fix None routing handling when merging unions"] PR20630["#20630 (draft)<br>vtgate: merge unions on join-predicate-free routings when all sources agree"] PR20755["#20755<br>vtgate: fix union merging through reference-table alternates"] PR20756["#20756 (draft)<br>vtgate: merge empty reference branches through rewritten copies"] PR20628 --> PR20630 PR20629 --> PR20630 PR20630 --> PR20756 PR20755 --> PR20756 end subgraph cte [Recursive CTEs] direction TB PR20759["#20759<br>vtgate: expand qualified stars without JOIN USING coalescing"] PR20633["#20633 (draft)<br>vtgate: validate the declared column list length of CTEs and derived tables"] PR20631["#20631 (draft)<br>vtgate: bind recursive CTE column filters as arguments in unmerged term queries"] PR20759 --> PR20633 PR20633 --> PR20631 end json ~~~ union ~~~ cte