Java Code Examples for com.datastax.driver.core.VersionNumber#parse()

The following examples show how to use com.datastax.driver.core.VersionNumber#parse() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CassandraSession.java    From presto with Apache License 2.0 5 votes vote down vote up
public VersionNumber getCassandraVersion()
{
    ResultSet result = executeWithSession(session -> session.execute("select release_version from system.local"));
    Row versionRow = result.one();
    if (versionRow == null) {
        throw new PrestoException(CASSANDRA_VERSION_ERROR, "The cluster version is not available. " +
                "Please make sure that the Cassandra cluster is up and running, " +
                "and that the contact points are specified correctly.");
    }
    return VersionNumber.parse(versionRow.getString("release_version"));
}
 
Example 2
Source File: TestCassandraClusteringPredicatesExtractor.java    From presto with Apache License 2.0 5 votes vote down vote up
@BeforeTest
void setUp()
{
    col1 = new CassandraColumnHandle("partitionKey1", 1, CassandraType.BIGINT, true, false, false, false);
    col2 = new CassandraColumnHandle("clusteringKey1", 2, CassandraType.BIGINT, false, true, false, false);
    col3 = new CassandraColumnHandle("clusteringKey2", 3, CassandraType.BIGINT, false, true, false, false);
    col4 = new CassandraColumnHandle("clusteringKe3", 4, CassandraType.BIGINT, false, true, false, false);

    cassandraTable = new CassandraTable(
            new CassandraTableHandle("test", "records"), ImmutableList.of(col1, col2, col3, col4));

    cassandraVersion = VersionNumber.parse("2.1.5");
}
 
Example 3
Source File: RepairUnitService.java    From cassandra-reaper with Apache License 2.0 4 votes vote down vote up
private static Integer versionCompare(String str1, String str2) {
  VersionNumber version1 = VersionNumber.parse(str1);
  VersionNumber version2 = VersionNumber.parse(str2);
  return version1.compareTo(version2);
}
 
Example 4
Source File: JmxProxyImpl.java    From cassandra-reaper with Apache License 2.0 3 votes vote down vote up
/**
 * Compares two Cassandra versions using classes provided by the Datastax Java Driver.
 *
 * @param str1 a string of ordinal numbers separated by decimal points.
 * @param str2 a string of ordinal numbers separated by decimal points.
 * @return The result is a negative integer if str1 is _numerically_ less than str2. The result is
 *     a positive integer if str1 is _numerically_ greater than str2. The result is zero if the
 *     strings are _numerically_ equal. It does not work if "1.10" is supposed to be equal to
 *     "1.10.0".
 */
static Integer versionCompare(String str1, String str2) {
  VersionNumber version1 = VersionNumber.parse(str1);
  VersionNumber version2 = VersionNumber.parse(str2);

  return version1.compareTo(version2);
}