diff --git a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/dao/PartitionMetadataDao.java b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/dao/PartitionMetadataDao.java index 7867932cd1ad..cdd175829e2a 100644 --- a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/dao/PartitionMetadataDao.java +++ b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/dao/PartitionMetadataDao.java @@ -82,9 +82,7 @@ public class PartitionMetadataDao { public boolean tableExists() { final String checkTableExistsStmt = "SELECT t.table_name FROM information_schema.tables AS t " - + "WHERE t.table_catalog = '' AND " - + "t.table_schema = '' AND " - + "t.table_name = '" + + "WHERE t.table_name = '" + metadataTableName + "'"; try (ResultSet queryResultSet = diff --git a/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/SpannerChangeStreamErrorTest.java b/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/SpannerChangeStreamErrorTest.java index 9ffa61c93078..2520e996e7bf 100644 --- a/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/SpannerChangeStreamErrorTest.java +++ b/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/SpannerChangeStreamErrorTest.java @@ -523,7 +523,7 @@ private ResultSet mockGetParentPartition(Timestamp startTimestamp, Timestamp aft private void mockTableExists() { Statement tableExistsStatement = Statement.of( - "SELECT t.table_name FROM information_schema.tables AS t WHERE t.table_catalog = '' AND t.table_schema = '' AND t.table_name = 'my-metadata-table'"); + "SELECT t.table_name FROM information_schema.tables AS t WHERE t.table_name = 'my-metadata-table'"); ResultSetMetadata tableExistsResultSetMetadata = ResultSetMetadata.newBuilder() .setRowType(