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 2021/03/02 13:37:48 UTC

[GitHub] [beam] iemejia commented on a change in pull request #13671: [BEAM-11571] Support Conversion to GenericRecords in Convert.to transform

iemejia commented on a change in pull request #13671:
URL: https://github.com/apache/beam/pull/13671#discussion_r585570049



##########
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/ConvertHelpers.java
##########
@@ -78,12 +83,15 @@ public ConvertedSchemaInformation(
   public static <T> ConvertedSchemaInformation<T> getConvertedSchemaInformation(
       Schema inputSchema, TypeDescriptor<T> outputType, SchemaRegistry schemaRegistry) {
     ConvertedSchemaInformation<T> convertedSchema = null;
-    boolean toRow = outputType.equals(TypeDescriptor.of(Row.class));
-    if (toRow) {
+    if (outputType.equals(TypeDescriptor.of(Row.class))) {
       // If the output is of type Row, then just forward the schema of the input type to the
       // output.
       convertedSchema =
           new ConvertedSchemaInformation<>((SchemaCoder<T>) SchemaCoder.of(inputSchema), null);
+    } else if (outputType.equals(TypeDescriptor.of(GenericRecord.class))) {
+      convertedSchema =
+          new ConvertedSchemaInformation<T>(
+              (SchemaCoder<T>) AvroUtils.schemaCoder(AvroUtils.toAvroSchema(inputSchema)), null);

Review comment:
       Jira created sorry I had not forgotten, just too long backlog :)
   https://issues.apache.org/jira/browse/BEAM-11911




----------------------------------------------------------------
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