Search in sources :

Example 1 with CassandraClusteringPredicatesExtractor

use of com.facebook.presto.cassandra.CassandraClusteringPredicatesExtractor in project presto by prestodb.

the class TestCassandraClusteringPredicatesExtractor method testBuildClusteringPredicate.

@Test
public void testBuildClusteringPredicate() {
    TupleDomain<ColumnHandle> tupleDomain = TupleDomain.withColumnDomains(ImmutableMap.of(col1, Domain.singleValue(BIGINT, 23L), col2, Domain.singleValue(BIGINT, 34L), col4, Domain.singleValue(BIGINT, 26L)));
    CassandraClusteringPredicatesExtractor predicatesExtractor = new CassandraClusteringPredicatesExtractor(cassandraTable.getClusteringKeyColumns(), tupleDomain);
    List<String> predicate = predicatesExtractor.getClusteringKeyPredicates();
    assertEquals(predicate.get(0), new StringBuilder("\"clusteringKey1\" = 34").toString());
}
Also used : CassandraColumnHandle(com.facebook.presto.cassandra.CassandraColumnHandle) ColumnHandle(com.facebook.presto.spi.ColumnHandle) CassandraClusteringPredicatesExtractor(com.facebook.presto.cassandra.CassandraClusteringPredicatesExtractor) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest)

Example 2 with CassandraClusteringPredicatesExtractor

use of com.facebook.presto.cassandra.CassandraClusteringPredicatesExtractor in project presto by prestodb.

the class TestCassandraClusteringPredicatesExtractor method testGetUnenforcedPredicates.

@Test
public void testGetUnenforcedPredicates() {
    TupleDomain<ColumnHandle> tupleDomain = TupleDomain.withColumnDomains(ImmutableMap.of(col2, Domain.singleValue(BIGINT, 34L), col4, Domain.singleValue(BIGINT, 26L)));
    CassandraClusteringPredicatesExtractor predicatesExtractor = new CassandraClusteringPredicatesExtractor(cassandraTable.getClusteringKeyColumns(), tupleDomain);
    TupleDomain<ColumnHandle> unenforcedPredicates = TupleDomain.withColumnDomains(ImmutableMap.of(col4, Domain.singleValue(BIGINT, 26L)));
    assertEquals(predicatesExtractor.getUnenforcedConstraints(), unenforcedPredicates);
}
Also used : CassandraColumnHandle(com.facebook.presto.cassandra.CassandraColumnHandle) ColumnHandle(com.facebook.presto.spi.ColumnHandle) CassandraClusteringPredicatesExtractor(com.facebook.presto.cassandra.CassandraClusteringPredicatesExtractor) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest)

Aggregations

CassandraClusteringPredicatesExtractor (com.facebook.presto.cassandra.CassandraClusteringPredicatesExtractor)2 CassandraColumnHandle (com.facebook.presto.cassandra.CassandraColumnHandle)2 ColumnHandle (com.facebook.presto.spi.ColumnHandle)2 BeforeTest (org.testng.annotations.BeforeTest)2 Test (org.testng.annotations.Test)2