[SPARK-48873][SQL] Use UnsafeRow in JSON parser. #47310
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.47) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 484 lines diff across 6 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.370
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #47310"
general
weight: 0.35
sadikovi
What changes were proposed in this pull request?
It uses
UnsafeRowto represent struct result in the JSON parser. It saves memory compared to the currentGenericInternalRow. The change is guarded by a flag and disabled by default.The benchmark shows that enabling the flag brings ~10% slowdown. This is basically expected because converting to
UnsafeRowrequires some work. The purpose of the PR is to provide an alternative to save memory.I did the following experiment. It generates a big
.gzJSON file containing a single large array. Each array element is a struct with 50 string fields and will be parsed into a row by the JSON reader.Then it processes the file in Spark shell with the following command:
When the flag is off (the current behavior), the query can process 2.5e5 rows but fails to process 3e5 rows. When the flag is on, the query can process 8e5 rows but fails to process 9e5 rows. We can say this change reduces the memory consumption to about 1/3.
Why are the changes needed?
It reduces the memory requirement of JSON-related query.
Does this PR introduce _any_ user-facing change?
No.
How was this patch tested?
A new JSON unit test with the config flag on.
Was this patch authored or co-authored using generative AI tooling?
No.