Package org.apache.spark.util
Class VersionUtils
Object
org.apache.spark.util.VersionUtils
Utilities for working with Spark version strings
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionmajorMinorPatchVersion
(String version) Extracts the major, minor and patch parts from the inputversion
.majorMinorVersion
(String sparkVersion) Given a Spark version string, return the (major version number, minor version number).static int
majorVersion
(String sparkVersion) Given a Spark version string, return the major version number.static int
minorVersion
(String sparkVersion) Given a Spark version string, return the minor version number.static String
shortVersion
(String sparkVersion) Given a Spark version string, return the short version string.
-
Constructor Details
-
VersionUtils
public VersionUtils()
-
-
Method Details
-
majorVersion
Given a Spark version string, return the major version number. E.g., for 2.0.1-SNAPSHOT, return 2.- Parameters:
sparkVersion
- (undocumented)- Returns:
- (undocumented)
-
minorVersion
Given a Spark version string, return the minor version number. E.g., for 2.0.1-SNAPSHOT, return 0.- Parameters:
sparkVersion
- (undocumented)- Returns:
- (undocumented)
-
shortVersion
Given a Spark version string, return the short version string. E.g., for 3.0.0-SNAPSHOT, return '3.0.0'.- Parameters:
sparkVersion
- (undocumented)- Returns:
- (undocumented)
-
majorMinorVersion
Given a Spark version string, return the (major version number, minor version number). E.g., for 2.0.1-SNAPSHOT, return (2, 0).- Parameters:
sparkVersion
- (undocumented)- Returns:
- (undocumented)
-
majorMinorPatchVersion
public static scala.Option<scala.Tuple3<Object,Object, majorMinorPatchVersionObject>> (String version) Extracts the major, minor and patch parts from the inputversion
. Note that if minor or patch version is missing from the input, this will return 0 for these parts. ReturnsNone
if the input is not of a valid format.Examples of valid version: - 1 (extracts to (1, 0, 0)) - 2.4 (extracts to (2, 4, 0)) - 3.2.2 (extracts to (3, 2, 2)) - 3.2.2.4 (extracts to 3, 2, 2)) - 3.3.1-SNAPSHOT (extracts to (3, 3, 1)) - 3.2.2.4SNAPSHOT (extracts to (3, 2, 2), only the first 3 components)
Examples of invalid version: - ABC - 1X - 2.4XYZ - 2.4-SNAPSHOT - 3.4.5ABC
- Parameters:
version
- (undocumented)- Returns:
- A non-empty option containing a 3-value tuple (major, minor, patch) iff the
input is a valid version.
None
otherwise.
-