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 2020/04/03 20:19:04 UTC

[GitHub] [beam] TheNeuralBit commented on a change in pull request #11259: Use attachValues in SQL

TheNeuralBit commented on a change in pull request #11259: Use attachValues in SQL
URL: https://github.com/apache/beam/pull/11259#discussion_r403298538
 
 

 ##########
 File path: sdks/java/extensions/sql/zetasql/src/main/java/org/apache/beam/sdk/extensions/sql/zetasql/BeamZetaSqlCalcRel.java
 ##########
 @@ -185,14 +193,19 @@ public void processElement(ProcessContext c) {
         return;
       }
 
-      Row.Builder output = Row.withSchema(outputSchema);
+      List<Object> values = Lists.newArrayListWithExpectedSize(outputSchema.getFieldCount());
       for (int i = 0; i < outputSchema.getFieldCount(); i++) {
         // TODO[BEAM-8630]: performance optimization by bundling the gRPC calls
         Value v = projectExps.get(i).execute(columns, params);
-        output.addValue(
-            ZetaSqlUtils.zetaSqlValueToJavaObject(v, outputSchema.getField(i).getType()));
+        values.add(
+            ZetaSqlUtils.zetaSqlValueToJavaObject(
+                v, outputSchema.getField(i).getType(), verifyRowValues));
       }
-      c.output(output.build());
+      Row outputRow =
+          verifyRowValues
+              ? Row.withSchema(outputSchema).addValues(values).build()
+              : Row.withSchema(outputSchema).attachValues(values);
 
 Review comment:
   and here

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services