[
https://issues.apache.org/jira/browse/BEAM-6861?focusedWorklogId=216083&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-216083
]
ASF GitHub Bot logged work on BEAM-6861:
----------------------------------------
Author: ASF GitHub Bot
Created on: 20/Mar/19 09:57
Start Date: 20/Mar/19 09:57
Worklog Time Spent: 10m
Work Description: iemejia commented on pull request #8090: [BEAM-6861]
Select fields and computed fields in CassandraIO.Read
URL: https://github.com/apache/beam/pull/8090#discussion_r267259434
##########
File path:
sdks/java/io/cassandra/src/test/java/org/apache/beam/sdk/io/cassandra/CassandraIOTest.java
##########
@@ -270,6 +273,68 @@ public void testReadWithWhere() throws Exception {
pipeline.run();
}
+ @Test
+ public void testSelectFields() throws Exception {
+ insertRecords();
+
+ PCollection<Scientist> output =
+ pipeline.apply(
+ CassandraIO.<Scientist>read()
+ .withHosts(pipeline.newProvider(Arrays.asList(CASSANDRA_HOST)))
+ .withPort(pipeline.newProvider(CASSANDRA_PORT))
+ .withKeyspace(pipeline.newProvider(CASSANDRA_KEYSPACE))
+ .withTable(pipeline.newProvider(CASSANDRA_TABLE))
+
.withSelectFields(pipeline.newProvider(Arrays.asList("person_id")))
+ .withCoder(SerializableCoder.of(Scientist.class))
+ .withEntity(Scientist.class)
+ .withWhere(pipeline.newProvider("person_id=10")));
+
+ PAssert.thatSingleton(output.apply("Count",
Count.globally())).isEqualTo(1L);
+ PAssert.that(output)
+ .satisfies(
+ input -> {
+ for (Scientist sci : input) {
+ assertNotNull(sci.id);
+ assertNull(sci.name);
+ }
+ return null;
+ });
+
+ pipeline.run();
+ }
+
+ @Test
+ public void testSelectFieldsWithFunction() throws Exception {
Review comment:
yes better do only one test
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 216083)
Time Spent: 1h 20m (was: 1h 10m)
> Select fields and computed fields in CassandraIO.Read
> ------------------------------------------------------
>
> Key: BEAM-6861
> URL: https://issues.apache.org/jira/browse/BEAM-6861
> Project: Beam
> Issue Type: Improvement
> Components: io-java-cassandra
> Reporter: Radosław Stankiewicz
> Assignee: Radosław Stankiewicz
> Priority: Minor
> Labels: features
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> CassandraIO.Read currently selects all fields and maps them to POJO.
> To make this component more flexible, it should be possible to select only
> subset of fields or computed fields to allow reading things like write
> Timestamp or using other functions.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)