acruise opened a new pull request, #7404:
URL: https://github.com/apache/datafusion-comet/pull/7404
## 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, in
`Utils.majorMinorPatchVersion`, and it no longer calls Spark's
`VersionUtils`. Moving the checks
themselves into `SparkFixes` is left for the rest of #7241.
## Rationale for this change
`org.apache.spark.util.VersionUtils` is `private[spark]`. Comet reaches it
from
`org.apache.spark.sql.comet.util.Utils`, which compiles only because that
object sits in a
`org.apache.spark` package, 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, `RegrSparkVersions` carried its own regex because it predates
the helper, so two
parsers read the same `SPARK_VERSION` string with different rules.
## What changes are included in this PR?
- `Utils.majorMinorPatchVersion` applies Spark's own
`VersionUtils.majorMinorPatchVersion` regex
itself: `^(\d+)(?:\.(\d+)(?:\.(\d+)(?:[.-].*)?)?)?$`. A missing minor or
patch reads as 0,
and anything after the patch that starts with `.` or `-` (`-SNAPSHOT`,
`-amzn-1`, a vendor
build number such as `.7.3.2.30000-15`) is ignored, exactly as Spark does.
Strings Spark would
reject (`v3.5.9`, `3.5.8x`) still return `None`.
- The Spark 3.5 `ShimCometScanExec.isSparkVersionAtLeast355` calls `Utils`
instead of
`VersionUtils` directly, and drops the `VersionUtils` import.
- `RegrSparkVersions.majorMinorPatch` calls `Utils.majorMinorPatchVersion`
and loses its private
regex. 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 the
other checks already took for it.
## How are these changes tested?
A new `UtilsSuite` test, `majorMinorPatchVersion parses Spark version
strings like Spark's
VersionUtils`, pins ten inputs to what Spark's `VersionUtils` returns for
them: plain releases,
`-SNAPSHOT`, an Amazon suffix, a Cloudera build number, `3.5` and `3` alone,
and the malformed
`3.5.8x`, `v3.5.9` and the empty string.
The existing `CometAggregateSuite` rows for `RegrSparkVersions`, including
the `v3.5.9` fallback
pin, and the Spark 3.5 scan shim's use of the helper cover the two call
sites.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]