feat: run inline, inline_outer, and stack generators natively #7251
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.50) × (1 − Review Confidence (0.45)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 367 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 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.353
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #7251"
general
weight: 0.35
rich7420
Which issue does this PR close?
Closes #5125.
Rationale for this change
GenerateExecruns natively only forexplodeandposexplode.inline(expanding an array of structs into columns) andstack(the standard unpivot) fall back to Spark and take the surrounding stage with them, often directly above a Parquet scan.What changes are included in this PR?
inline/inline_outer: a newinlineflag on theExplodeproto message. The native planner unnests the array as before, then hasExplodeExecflatten the struct into one column per field, using the struct unnesting that theUnnestExecfork already carries. Every generated column is reported nullable.flatten_struct_colsfolds a struct's null mask into each field it flattens, usingchildren_with_parent_nullsfromdatafusion-comet-common. Arrow leaves field values under a null struct unspecified, and Spark'sinlineemits a row of nulls for a null element.stack: the serde rewritesstack(n, v1, ..., vk)intoinlineoverarray(named_struct(...), ...), one struct per output row, padding the last row with null literals of the column type. Each argument is still evaluated once per input row, as in Spark. If an argument cannot be converted, the operator reports that argument's own fallback reason. Astackthat Spark does not code-generate (more than 50 rows) stays on Spark, because the rewrite builds one struct expression per output row.inlineandinline_outerover an array of structs with no fields stay on Spark. The unnested rows would have no column to hold their count.understanding-comet-plans.md, and audit notes for the three generators.InlineandStackbehave the same in Spark 3.4.3, 3.5.8, 4.0.1 and 4.1.1.How are these changes tested?
expressions/array/inline.sqlandexpressions/misc/stack.sql, which assert native execution and match Spark. They cover NULL, empty and NULL-element arrays, NULL fields, the_outervariant,LATERAL VIEW, a struct field named like a carried column, nested and wide field types, arrays built in the query, unevenstackargument counts, NULL literal arguments, and filters and aggregates above the generator.flatten_struct_colswith a null struct over non-null field values, including a sliced input.CometGenerateExecSuitetest that astackargument which cannot run natively falls back with its own reason.CometGenerateExecSuitetests thatstackabove 50 rows andinline/inline_outerover an array of zero-field structs fall back, and thatstackwith exactly 50 rows runs natively.CometGenerateExecSuite(57 passed), theinline,stack,explodeandposexplodeSQL files, and theexplodeRust tests.