use of io.prestodb.tempto.query.QueryResult in project urban-eureka by errir503.
the class TestSelect method testSelectWithEqualityFilterOnNonPartitioningKey.
@Test(groups = CASSANDRA)
public void testSelectWithEqualityFilterOnNonPartitioningKey() {
String sql = format("SELECT n_name FROM %s.%s.%s WHERE n_name = 'UNITED STATES'", CONNECTOR_NAME, KEY_SPACE, CASSANDRA_NATION.getName());
QueryResult queryResult = onPresto().executeQuery(sql);
assertThat(queryResult).containsOnly(row("UNITED STATES"));
}
use of io.prestodb.tempto.query.QueryResult in project urban-eureka by errir503.
the class TestSelect method testSelectAllTypePartitioningMaterializedView.
@Test(groups = CASSANDRA)
public void testSelectAllTypePartitioningMaterializedView() {
String materializedViewName = format("%s_partitioned_mv", CASSANDRA_ALL_TYPES.getName());
onCassandra(format("DROP MATERIALIZED VIEW IF EXISTS %s.%s", KEY_SPACE, materializedViewName));
onCassandra(format("CREATE MATERIALIZED VIEW %s.%s AS SELECT * FROM %s.%s WHERE b IS NOT NULL PRIMARY KEY (a, b)", KEY_SPACE, materializedViewName, KEY_SPACE, CASSANDRA_ALL_TYPES.getName()));
assertContainsEventually(() -> query(format("SHOW TABLES FROM %s.%s", CONNECTOR_NAME, KEY_SPACE)), query(format("SELECT '%s'", materializedViewName)), new Duration(1, MINUTES));
// Materialized view may not return all results during the creation
assertContainsEventually(() -> query(format("SELECT status_replicated FROM %s.system.built_views WHERE view_name = '%s'", CONNECTOR_NAME, materializedViewName)), query("SELECT true"), new Duration(1, MINUTES));
QueryResult query = query(format("SELECT a, b, bl, bo, d, do, dt, f, fr, i, integer, l, m, s, si, t, ti, ts, tu, u, v, vari FROM %s.%s.%s WHERE a = '\0'", CONNECTOR_NAME, KEY_SPACE, materializedViewName));
assertThat(query).hasColumns(VARCHAR, BIGINT, VARBINARY, BOOLEAN, DOUBLE, DOUBLE, DATE, REAL, VARCHAR, VARCHAR, INTEGER, VARCHAR, VARCHAR, VARCHAR, SMALLINT, VARCHAR, TINYINT, TIMESTAMP, VARCHAR, VARCHAR, VARCHAR, VARCHAR).containsOnly(row("\0", Long.MIN_VALUE, Bytes.fromHexString("0x00").array(), false, 0f, Double.MIN_VALUE, Date.valueOf("1970-01-02"), Float.MIN_VALUE, "[0]", "0.0.0.0", Integer.MIN_VALUE, "[0]", "{\"\\u0000\":-2147483648,\"a\":0}", "[0]", Short.MIN_VALUE, "\0", Byte.MIN_VALUE, Timestamp.valueOf(LocalDateTime.of(1970, 1, 1, 0, 0)), "d2177dd0-eaa2-11de-a572-001b779c76e3", "01234567-0123-0123-0123-0123456789ab", "\0", String.valueOf(Long.MIN_VALUE)));
onCassandra(format("DROP MATERIALIZED VIEW IF EXISTS %s.%s", KEY_SPACE, materializedViewName));
}
use of io.prestodb.tempto.query.QueryResult in project urban-eureka by errir503.
the class TestSelect method testSelectWithMorePartitioningKeysThanLimit.
@Test(groups = CASSANDRA)
public void testSelectWithMorePartitioningKeysThanLimit() {
String sql = format("SELECT s_suppkey FROM %s.%s.%s WHERE s_suppkey = 10", CONNECTOR_NAME, KEY_SPACE, CASSANDRA_SUPPLIER.getName());
QueryResult queryResult = onPresto().executeQuery(sql);
assertThat(queryResult).containsOnly(row(10));
}
use of io.prestodb.tempto.query.QueryResult in project urban-eureka by errir503.
the class TestSelect method testNationJoinNation.
@Test(groups = CASSANDRA)
public void testNationJoinNation() {
String tableName = format("%s.%s.%s", CONNECTOR_NAME, KEY_SPACE, CASSANDRA_NATION.getName());
String sql = format("SELECT n1.n_name, n2.n_regionkey FROM %s n1 JOIN " + "%s n2 ON n1.n_nationkey = n2.n_regionkey " + "WHERE n1.n_nationkey=3", tableName, tableName);
QueryResult queryResult = onPresto().executeQuery(sql);
assertThat(queryResult).containsOnly(row("CANADA", 3), row("CANADA", 3), row("CANADA", 3), row("CANADA", 3), row("CANADA", 3));
}
use of io.prestodb.tempto.query.QueryResult in project urban-eureka by errir503.
the class TestSelect method testSelectWithFilterOnPartitioningKey.
@Test(groups = CASSANDRA)
public void testSelectWithFilterOnPartitioningKey() {
String sql = format("SELECT n_nationkey FROM %s.%s.%s WHERE n_nationkey > 23", CONNECTOR_NAME, KEY_SPACE, CASSANDRA_NATION.getName());
QueryResult queryResult = onPresto().executeQuery(sql);
assertThat(queryResult).containsOnly(row(24));
}
Aggregations