[ https://issues.apache.org/jira/browse/BEAM-7829?focusedWorklogId=302939&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-302939 ]
ASF GitHub Bot logged work on BEAM-7829: ---------------------------------------- Author: ASF GitHub Bot Created on: 28/Aug/19 15:08 Start Date: 28/Aug/19 15:08 Worklog Time Spent: 10m Work Description: RyanSkraba commented on pull request #9247: [BEAM-7829] Add schema names when converting with AvroUtils.toAvroSchema URL: https://github.com/apache/beam/pull/9247#discussion_r318636099 ########## File path: sdks/java/core/src/test/java/org/apache/beam/sdk/schemas/utils/AvroUtilsTest.java ########## @@ -324,6 +339,59 @@ public void testFromBeamSchema() { assertEquals(getAvroSchema(), avroSchema); } + @Test + public void testAvroSchemaFromBeamSchemaCanBeParsed() { + String stringSchema = AvroUtils.toAvroSchema(getBeamSchema()).toString(); + org.apache.avro.Schema schema = new org.apache.avro.Schema.Parser().parse(stringSchema); + assertEquals(stringSchema, schema.toString()); Review comment: Changed and rebased with the recent fix on master! I interactively squashed the commits on my end to retain @iemejia's work. ---------------------------------------------------------------- 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: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 302939) Time Spent: 2h 10m (was: 2h) > AvroUtils.toAvroSchema should put a Schema name to pass Avro Schema validation > ------------------------------------------------------------------------------ > > Key: BEAM-7829 > URL: https://issues.apache.org/jira/browse/BEAM-7829 > Project: Beam > Issue Type: Test > Components: io-java-avro, sdk-java-core > Reporter: Ismaël Mejía > Assignee: Ryan Skraba > Priority: Minor > Fix For: 2.16.0 > > Time Spent: 2h 10m > Remaining Estimate: 0h > > While trying to use an Avro PCollection with the SQL transform I notice you > could not do correctly a bijective transform: PCollection<GenericRecord> -> > SQL -> PCollection<Row> -> ParDo -> PCollection<GenericRecord> I noticed that > some of the Avro metadata gets lost in particular the name of the Avro > Schema. This is important because Avro validates that the schema has a name > and if it does not it breaks with a ParseException. > {quote} > org.apache.avro.SchemaParseException: Illegal character in: EXPR$1 > at org.apache.avro.Schema.validateName (Schema.java:1151) > at org.apache.avro.Schema.access$200 (Schema.java:81) > at org.apache.avro.Schema$Field.<init> (Schema.java:403) > at org.apache.avro.Schema$Field.<init> (Schema.java:423) > at org.apache.avro.Schema$Field.<init> (Schema.java:415){quote} -- This message was sent by Atlassian Jira (v8.3.2#803003)