damccorm commented on code in PR #32008:
URL: https://github.com/apache/beam/pull/32008#discussion_r1731364049


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/SpannerIO.java:
##########
@@ -876,6 +913,18 @@ public Read withHighPriority() {
       return withSpannerConfig(config.withRpcPriority(RpcPriority.HIGH));
     }
 
+    private SpannerSourceDef createSourceDef() {
+      SpannerSourceDef sourceDef;
+      if (getReadOperation().getQuery() != null) {
+        sourceDef = SpannerQuerySourceDef.create(getSpannerConfig(), 
getReadOperation().getQuery());
+      } else {
+        sourceDef =
+            SpannerTableSourceDef.create(
+                getSpannerConfig(), getReadOperation().getTable(), 
getReadOperation().getColumns());
+      }
+      return sourceDef;

Review Comment:
   Nit: Can be cleaned up a bit with an early return
   
   ```suggestion
         if (getReadOperation().getQuery() != null) {
           return SpannerQuerySourceDef.create(getSpannerConfig(), 
getReadOperation().getQuery());
         }
         
         return SpannerTableSourceDef.create(
             getSpannerConfig(), getReadOperation().getTable(), 
getReadOperation().getColumns());;
   ```



##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/StructUtils.java:
##########
@@ -38,6 +39,20 @@
 
 final class StructUtils {
 
+  private static final SpannerIO.Read.ToBeamRowFunction 
STRUCT_TO_BEAM_ROW_FUNCTION =
+      schema -> (Struct struct) -> structToBeamRow(struct, schema);
+
+  public static SpannerIO.Read.ToBeamRowFunction structToBeamRow() {
+    return STRUCT_TO_BEAM_ROW_FUNCTION;
+  }
+
+  private static final SpannerIO.Read.FromBeamRowFunction 
STRUCT_FROM_BEAM_ROW_FUNCTION =

Review Comment:
   Do we need the same type coersion as below?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to