refactor: parse Spark versions in Comet instead of calling Spark's private VersionUtils #7404
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.40) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 319 lines diff across 3 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.345
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #7404"
general
weight: 0.35
comphead
Which issue does this PR close?
Part of #7241. That issue asks for the patch-release version checks to share one parser and one
home (
SparkFixes). This PR does the parser half: Comet now has one version parser, inUtils.majorMinorPatchVersion, and it no longer calls Spark'sVersionUtils. Moving the checksthemselves into
SparkFixesis left for the rest of #7241.Rationale for this change
org.apache.spark.util.VersionUtilsisprivate[spark]. Comet reaches it fromorg.apache.spark.sql.comet.util.Utils, which compiles only because that object sits in aorg.apache.sparkpackage, and vendor builds of Spark have changed the method's signature(Cloudera's returns a 4-tuple with the vendor suffix), so Comet fails to link against them.
Separately,
RegrSparkVersionscarried its own regex because it predates the helper, so twoparsers read the same
SPARK_VERSIONstring with different rules.What changes are included in this PR?
Utils.majorMinorPatchVersionapplies Spark's ownVersionUtils.majorMinorPatchVersionregexitself:
^(\d+)(?:\.(\d+)(?:\.(\d+)(?:[.-].*)?)?)?$. A missing minor or patch reads as 0,and anything after the patch that starts with
.or-(-SNAPSHOT,-amzn-1, a vendorbuild number such as
.7.3.2.30000-15) is ignored, exactly as Spark does. Strings Spark wouldreject (
v3.5.9,3.5.8x) still returnNone.ShimCometScanExec.isSparkVersionAtLeast355callsUtilsinstead ofVersionUtilsdirectly, and drops theVersionUtilsimport.RegrSparkVersions.majorMinorPatchcallsUtils.majorMinorPatchVersionand loses its privateregex. Its fallback to the minor-version rule for an unparseable string is unchanged. The one
behavioural difference is for a string such as
4.0.5_vendor: the old regex read it as(4, 0, 5), Spark's regex does not, so the regression checks now take the same fallback theother checks already took for it.
How are these changes tested?
A new
UtilsSuitetest,majorMinorPatchVersion parses Spark version strings like Spark's, pins ten inputs to what Spark'sVersionUtils
VersionUtilsreturns for them: plain releases,-SNAPSHOT, an Amazon suffix, a Cloudera build number,3.5and3alone, and the malformed3.5.8x,v3.5.9and the empty string.The existing
CometAggregateSuiterows forRegrSparkVersions, including thev3.5.9fallbackpin, and the Spark 3.5 scan shim's use of the helper cover the two call sites.
🤖 Generated with Claude Code