← Back to Pull requests

MDEV-42361 Assertion `0' failed in Item_param::can_return_value() on PREPARE of JSON_ARRAY_INTERSECT(?, 1) or JSON_OBJECT_FILTER_KEYS(1, ?) (the defect of MDEV-31599, fixed there for JSON_SCHEMA_VALID only) #6195

Open
unknown opened this pull request with 157 lines diff across 1 files
View on GitHub
unknown unknown commented on Nov 23, 2026 07:04 UTC
Author

MDEV-42361: https://jira.mariadb.org/browse/MDEV-42361

Problem: Item_func_json_object_filter_keys::fix_length_and_dec() was accessing args[1] unconditionally to build the hash of the keys. During PREPARE, a parameter has no value yet (NO_VALUE), causing Item_param::can_return_value() to hit DBUG_ASSERT(0) in debug builds.

The fix is to parse the keys in fix_length_and_dec() only when args[1] is a constant. A parameter is not considered constant during PREPARE, but becomes constant when the statement is executed and fix_length_and_dec() runs again. This ensures that the hash is built once per execution.

For keys that change between rows, such as a column, val_str() parses them for each row through create_keys_hash(), which frees the hash from the previous call before creating a new one.

JSON_ARRAY_INTERSECT(?, 1) already works in 11.4 and 11.8 due to its const_item() check. However, it still asserts in 12.3 and main, where the function was rewritten. This will be addressed in a separate PR.

Test: Added a single PREPARE of JSON_OBJECT_FILTER_KEYS(1, ?) to main.func_json. Without the fix, the server aborts during PREPARE; with the fix, the test passes, including with --ps-protocol.

Diff: 157 lines (+117 / -40) across 1 files Reviewer: gkodinov Review duration: 11472m
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.33) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.33 · 157 lines diff across 1 files
0.33
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
46%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth shallow_review_depth
0.344
Diff Size diff_size
0.303
Real PR Conversation Timeline
1 comments
"Review active on #6195"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 46.7% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 33.3% (LOW) · Higher = larger blast radius
33.3%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 46.7% · Lower = rushed or shallow review
46.7%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 17.7% · Safe to merge
17.7%
Repository