feat(spark): add Spark-compatible json_array_length function #71
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 247 lines diff across 3 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.330
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #71"
general
weight: 0.35
kosiew
Part of #242.
Summary
json_array_length(jsonArray), ported from DataFusion Comet'sjson_funcs/json_array_length.rs.Utf8,LargeUtf8andUtf8View. Like Spark, other types such as integers are rejected at planning time.serdeas a direct dependency (already in the graph throughserde_json) for the streaming array counter.#[user_doc]and implementsdocumentation(), following the guidelines inCONTRIBUTING.md(as in #58).Known gaps
Spark parses with a Jackson factory that enables single-quoted strings and unescaped control characters (
JsonExpressionEvalUtils.SharedFactory, for Hive compatibility).serde_jsonrejects both, sojson_array_length("['a','b']")is NULL here and 2 in Spark.Jackson (Spark 3.5+) also has stream limits that are not emulated here:
These cases are commented-out queries in the
.sltfile with Spark's results. They stay open in #242.Testing
json/json_array_length.sltcovers scalar and column input, all three string types, malformed nested elements, leading zeros,NaN, comments, trailing commas, multi-byte UTF-8, trailing content, and ANSI mode on and off. Expected values come from Spark'sjson-functions.sql.outor were checked against PySpark 4.2.0; the PySpark runner passes on the file.cargo clippy --all-targets --all-features -- -D warnings,cargo test -p datafusion-sparkandcargo test -p datafusion-spark-sqllogictestpass.🤖 Generated with Claude Code