test: run sqllogictests with and without constant folding #316
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 397 lines diff across 4 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.358
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #316"
general
weight: 0.35
kosiew
Which issue does this PR close?
None. It adds the test coverage that found #305–#315.
Rationale for this change
A Spark function can run in two ways. When every argument is a literal, the
simplify_expressionsoptimizer rule constant-folds the call while planning. That callsScalarUDFImpl::simplify(if the function has one) and evaluates the result on a one-row batch. Otherwise the call runs throughinvoke_with_argsduring execution. That is also the only path for engines such as Comet that build physical expressions directly.Most
.sltqueries are literal-only, such asSELECT f(1), so today they only test the first path.invoke_with_argsmust always work, andsimplifyis an optional optimization. This PR runs the tests through both paths.What changes are included in this PR?
.sltfile twice:-
simplify: the default optimizer, as before.-
evaluate: the same optimizer rules withsimplify_expressionsreplaced by a rule that rewrites only DataFusion's rewrite-only functions (arrow_cast,arrow_try_cast,cast_to_type,try_cast_to_type,nvl2). The tests use those to build typed inputs, and theirinvoke_with_argsalways errors. Every other call, including literal-only calls of the Spark functions, runs throughinvoke_with_args..sltlabel, so a record can be markedskipif evaluate. (skipifrather thanonlyif simplify, because the PySpark runner skipsonlyifrecords that are not forspark.)--mode=simplifyor--mode=evaluateruns a single mode. Results print asPASS [evaluate] path.evaluatemode yet is markedskipif evaluate, with a note at the top of the file linking its issue.--completeruns only insimplifymode, so each file is rewritten once.test_files/README.mddocuments the two modes.What
evaluatemode foundEight functions have no working
invoke_with_args: they error unlesssimplifyrewrites them first. Their records are markedskipif evaluate.| Function | Issue |
|---|---|
|
if| #305 ||
unix_date| #306 ||
date_diff| #307 ||
date_trunc| #309 ||
time_trunc| #310 ||
trunc| #311 ||
add_months| #312 ||
base64| #313 |Two bugs in the
invoke_with_argspath, each with one query markedskipif evaluate:concat_wspanics when all arguments are scalars andnumber_rows> 1. This is the same pattern #68 fixed inhash.make_dt_intervaldeclares a non-nullable result but can return NULL.Are these changes tested?
cargo test -p datafusion-spark-sqllogictestruns all 257 files in both modes (514 runs). To check which files need the evaluate path, I temporarily ran each failing file record by record, so a file's first failure didn't hide the rest. Every evaluate-mode failure is one of the issues above. Theskipif evaluatemarks do not change what the PySpark runner runs.Are there any user-facing changes?
No. CI's sqllogictest job takes longer because every file now runs twice.