[SPARK-60871][SQL][4.x] Respect collated result types in variant_get and JSON RETURNING #60391
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 181 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
Diff Size
diff_size
0.311
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #60391"
general
weight: 0.35
uros-b
Backport of #60060 to 4.x
What changes were proposed in this pull request?
1. Goal:
variant_get/try_variant_getwith a collated target type, andJSON_VALUE/JSON_QUERY/JSON_ARRAY/JSON_OBJECTwith a collatedRETURNINGtype, compare using that collation.2. Problem: The result takes the collation of the arguments, so it gets cast back to UTF8_BINARY before the comparison.
3. Solution: These expressions now take the collation of an explicitly collated result type with implicit strength, like a column of that type. Plain
STRINGis unchanged. Runtime Bloom filters are also skipped for join keys that aren't binary stable, since the filter hashes raw bytes and can drop rows that match under the collation.Why are the changes needed?
Wrong results.
Does this PR introduce _any_ user-facing change?
Yes. These results now use the declared collation. Mixing one with a string of a different implicit collation, e.g. a plain
STRINGcolumn, fails withINDETERMINATE_COLLATION_IN_EXPRESSION, same as two columns with different collations. See the migration guide note.How was this patch tested?
New tests.
Was this patch authored or co-authored using generative AI tooling?
Co-authored-by: Claude Opus 5.5