You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/12/30 15:42:03 UTC
[GitHub] [beam] Abacn commented on a diff in pull request #24830: Fix Cassandra read bug when user query has no where clause (fixes #24829)
Abacn commented on code in PR #24830:
URL: https://github.com/apache/beam/pull/24830#discussion_r1059434802
##########
sdks/java/io/cassandra/src/test/java/org/apache/beam/sdk/io/cassandra/CassandraIOTest.java:
##########
@@ -485,6 +489,39 @@ public void testReadWithQuery() throws Exception {
pipeline.run();
}
+ @Test
+ public void testReadWithUnfilteredQuery() throws Exception {
+ String query =
+ String.format(
+ "select person_id, writetime(person_name) from %s.%s",
+ CASSANDRA_KEYSPACE, CASSANDRA_TABLE);
+
+ PCollection<Scientist> output =
+ pipeline.apply(
+ CassandraIO.<Scientist>read()
+ .withHosts(Collections.singletonList(CASSANDRA_HOST))
+ .withPort(cassandraPort)
+ .withKeyspace(CASSANDRA_KEYSPACE)
+ .withTable(CASSANDRA_TABLE)
+ .withMinNumberOfSplits(20)
+ .withQuery(query)
+ .withCoder(SerializableCoder.of(Scientist.class))
+ .withEntity(Scientist.class));
+
+ PAssert.thatSingleton(output.apply("Count", Count.globally())).isEqualTo(22L);
Review Comment:
```suggestion
PAssert.thatSingleton(output.apply("Count", Count.globally())).isEqualTo(NUM_ROWS);
```
##########
CHANGES.md:
##########
@@ -80,7 +80,7 @@
## Bugfixes
-* Fixed X (Java/Python) ([#X](https://github.com/apache/beam/issues/X)).
+* Avoids Cassandra syntax error when user-defined query has no where clause in it (Java/Python) ([#24829](https://github.com/apache/beam/issues/24829)).
Review Comment:
```suggestion
* Avoids Cassandra syntax error when user-defined query has no where clause in it (Java) ([#24829](https://github.com/apache/beam/issues/24829)).
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org