From a5dd13d3d2d2e7b22f52e3ab7df4467bfb88f3ef Mon Sep 17 00:00:00 2001 From: tangjiangling Date: Fri, 25 Feb 2022 00:26:50 +0800 Subject: [PATCH] Use TestCassandraTable in testClusteringKeyOnlyPushdown to test --- .../cassandra/TestCassandraConnectorTest.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/plugin/trino-cassandra/src/test/java/io/trino/plugin/cassandra/TestCassandraConnectorTest.java b/plugin/trino-cassandra/src/test/java/io/trino/plugin/cassandra/TestCassandraConnectorTest.java index eed56f6b14d4..f639803e00b4 100644 --- a/plugin/trino-cassandra/src/test/java/io/trino/plugin/cassandra/TestCassandraConnectorTest.java +++ b/plugin/trino-cassandra/src/test/java/io/trino/plugin/cassandra/TestCassandraConnectorTest.java @@ -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