Example usage for org.apache.hadoop.util VersionUtil compareVersions

List of usage examples for org.apache.hadoop.util VersionUtil compareVersions

Introduction

In this page you can find the example usage for org.apache.hadoop.util VersionUtil compareVersions.

Prototype

public static int compareVersions(String version1, String version2) 

Source Link

Document

Compares two version name strings using maven's ComparableVersion class.

Usage

From source file:org.apache.drill.exec.store.parquet.ParquetReaderUtility.java

License:Apache License

/**
 * If binary metadata was stored prior to Drill version {@link #ALLOWED_DRILL_VERSION_FOR_BINARY},
 * it might have incorrectly defined min / max values.
 * In case if given version is null, we assume this version is prior to {@link #ALLOWED_DRILL_VERSION_FOR_BINARY}.
 * In this case we allow reading such metadata only if {@link ParquetReaderConfig#enableStringsSignedMinMax()} is true.
 *
 * @param drillVersion drill version used to create metadata file
 * @param readerConfig parquet reader configuration
 * @return true if reading binary min / max values are allowed, false otherwise
 *///from  w w w  .j a v  a 2  s .c om
private static boolean allowBinaryMetadata(String drillVersion, ParquetReaderConfig readerConfig) {
    return readerConfig.enableStringsSignedMinMax() || (drillVersion != null
            && VersionUtil.compareVersions(ALLOWED_DRILL_VERSION_FOR_BINARY, drillVersion) <= 0);
}

From source file:org.apache.zeppelin.spark.SparkShims.java

License:Apache License

/**
 * This is temporal patch for support old versions of Yarn which is not adopted YARN-6615
 *
 * @return true if YARN-6615 is patched, false otherwise
 *///from   w w w .  j ava 2 s .  c o m
protected boolean supportYarn6615(String version) {
    return (VersionUtil.compareVersions(HADOOP_VERSION_2_6_6, version) <= 0
            && VersionUtil.compareVersions(HADOOP_VERSION_2_7_0, version) > 0)
            || (VersionUtil.compareVersions(HADOOP_VERSION_2_7_4, version) <= 0
                    && VersionUtil.compareVersions(HADOOP_VERSION_2_8_0, version) > 0)
            || (VersionUtil.compareVersions(HADOOP_VERSION_2_8_2, version) <= 0
                    && VersionUtil.compareVersions(HADOOP_VERSION_2_9_0, version) > 0)
            || (VersionUtil.compareVersions(HADOOP_VERSION_2_9_0, version) <= 0
                    && VersionUtil.compareVersions(HADOOP_VERSION_3_0_0, version) > 0)
            || (VersionUtil.compareVersions(HADOOP_VERSION_3_0_0_ALPHA4, version) <= 0)
            || (VersionUtil.compareVersions(HADOOP_VERSION_3_0_0, version) <= 0);
}