LuciferYang opened a new pull request, #7726:
URL: https://github.com/apache/kyuubi/pull/7726

   ### Why are the changes needed?
   
   Closes #7725.
   
   `SemanticVersion`'s regex made the minor group optional while keeping a 
trailing group that also starts with `.`:
   
   ```
   ^(\d+)(?:\.(\d+))?(\..*)?$
   ```
   
   On `"1.2-SNAPSHOT"` the trailing group cannot match the `-`, so the engine 
backtracks past the minor group and lets the trailing group swallow 
`.2-SNAPSHOT`. The parse succeeds as `(major=1, minor=0)` with the minor 
silently dropped, so `isVersionAtLeast`/`isVersionAtMost` compare against the 
wrong version. This is reachable for Flink development builds (`X.Y-SNAPSHOT` 
from `EnvironmentInformation.getVersion`, checked in 
`FlinkEngineUtils.checkFlinkVersion`): a supported `1.20-SNAPSHOT` is rejected 
with `UnsupportedOperationException`, and an unsupported `2.4-SNAPSHOT` slips 
through as `2.0`.
   
   Letting the trailing group start with `.` or `-` (`(?:[.-].*)?`) keeps the 
minor group and lets the suffix be consumed after it, matching how 
`.4-SNAPSHOT` was already handled following a minor. Capture groups 1 and 2 are 
unchanged, and the trailing group was never read, so making it non-capturing is 
safe.
   
   ### How was this patch tested?
   
   Added a `SemanticVersionSuite` case asserting `"1.2-SNAPSHOT"` parses to 
`(1, 2)` and satisfies the `1.1`/`1.3` bounds; it fails on the old regex (minor 
0). The existing cases parse identically under both regexes.
   
   ```
   build/mvn test -pl kyuubi-util-scala -am
   build/mvn scalastyle:check spotless:check -pl kyuubi-util-scala -am
   ```
   
   Module green on Zulu 17.0.18, scalastyle 0 errors, spotless clean.
   
   ### Was this patch assisted by generative AI tooling?
   
   Assisted-by: Claude Opus 4.8
   


-- 
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]

Reply via email to