use of io.prestodb.tempto.query.QueryResult in project urban-eureka by errir503.
the class TestSelect method testSelectWithNonEqualityFilterOnNonPartitioningKey.
@Test(groups = CASSANDRA)
public void testSelectWithNonEqualityFilterOnNonPartitioningKey() {
String sql = format("SELECT n_name FROM %s.%s.%s WHERE n_name < 'B'", CONNECTOR_NAME, KEY_SPACE, CASSANDRA_NATION.getName());
QueryResult queryResult = onPresto().executeQuery(sql);
assertThat(queryResult).containsOnly(row("ALGERIA"), row("ARGENTINA"));
}
use of io.prestodb.tempto.query.QueryResult in project urban-eureka by errir503.
the class TestSelect method testAllDataTypes.
@Test(groups = CASSANDRA)
public void testAllDataTypes() {
// NOTE: DECIMAL is treated like DOUBLE
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", CONNECTOR_NAME, KEY_SPACE, CASSANDRA_ALL_TYPES.getName()));
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)), row("the quick brown fox jumped over the lazy dog", 9223372036854775807L, "01234".getBytes(), true, new Double("99999999999999999999999999999999999999"), Double.MAX_VALUE, Date.valueOf("9999-12-31"), Float.MAX_VALUE, "[4,5,6,7]", "255.255.255.255", Integer.MAX_VALUE, "[4,5,6]", "{\"a\":1,\"b\":2}", "[4,5,6]", Short.MAX_VALUE, "this is a text value", Byte.MAX_VALUE, Timestamp.valueOf(LocalDateTime.of(9999, 12, 31, 23, 59, 59)), "d2177dd0-eaa2-11de-a572-001b779c76e3", "01234567-0123-0123-0123-0123456789ab", "abc", String.valueOf(Long.MAX_VALUE)), row("def", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null));
}
use of io.prestodb.tempto.query.QueryResult in project urban-eureka by errir503.
the class TestSelect method testSelectWithEqualityFilterOnPartitioningKey.
@Test(groups = CASSANDRA)
public void testSelectWithEqualityFilterOnPartitioningKey() {
String sql = format("SELECT n_nationkey FROM %s.%s.%s WHERE n_nationkey = 0", CONNECTOR_NAME, KEY_SPACE, CASSANDRA_NATION.getName());
QueryResult queryResult = onPresto().executeQuery(sql);
assertThat(queryResult).containsOnly(row(0));
}
use of io.prestodb.tempto.query.QueryResult in project urban-eureka by errir503.
the class TestSelect method testSelectWithMorePartitioningKeysThanLimitNonPK.
@Test(groups = CASSANDRA)
public void testSelectWithMorePartitioningKeysThanLimitNonPK() {
String sql = format("SELECT s_suppkey FROM %s.%s.%s WHERE s_name = 'Supplier#000000010'", 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 testNationJoinRegion.
@Test(groups = CASSANDRA)
public void testNationJoinRegion() {
String sql = format("SELECT c.n_name, t.name FROM %s.%s.%s c JOIN " + "tpch.tiny.region t ON c.n_regionkey = t.regionkey " + "WHERE c.n_nationkey=3", CONNECTOR_NAME, KEY_SPACE, CASSANDRA_NATION.getName());
QueryResult queryResult = onPresto().executeQuery(sql);
assertThat(queryResult).containsOnly(row("CANADA", "AMERICA"));
}
Aggregations