Skip to content

Commit

Permalink
Use TestCassandraTable in testClusteringKeyOnlyPushdown to test
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjiangling authored and ebyhr committed Feb 25, 2022
1 parent 612b7db commit a5dd13d
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,17 +322,15 @@ public void testPushdownAllTypesPartitionKeyPredicate()

@Test
public void testPartitionPushdownsWithNotMatchingPredicate()
throws Exception
{
String table = "partition_not_pushed_down_keys";
session.execute(format("DROP TABLE IF EXISTS %s.%s", KEYSPACE, table));
session.execute(format("CREATE TABLE %s.%s ( id varchar, trino_filter_col int, PRIMARY KEY (id))", KEYSPACE, table));
session.execute(format("INSERT INTO %s.%s(id, trino_filter_col) VALUES ('2', 0)", KEYSPACE, table));
server.refreshSizeEstimates(KEYSPACE, table);

String sql = "SELECT 1 FROM " + table + " WHERE id = '1' AND trino_filter_col = 0";
try (TestCassandraTable testCassandraTable = testTable(
"partition_not_pushed_down_keys",
ImmutableList.of(partitionColumn("id", "varchar"), generalColumn("trino_filter_col", "int")),
ImmutableList.of("'2', 0"))) {
String sql = "SELECT 1 FROM " + testCassandraTable.getTableName() + " WHERE id = '1' AND trino_filter_col = 0";

assertThat(execute(sql).getMaterializedRows().size()).isEqualTo(0);
assertThat(execute(sql).getMaterializedRows().size()).isEqualTo(0);
}
}

@Test
Expand Down

0 comments on commit a5dd13d

Please sign in to comment.