evanchen852 opened a new pull request, #41856:
URL: https://github.com/apache/beam/pull/41856

   ## Summary
   - `FILE_LOADS` Avro writes (`withAvroFormatFunction` / `withAvroWriter`) 
throw `UnresolvedUnionException` when a NULLABLE RECORD column is filled with a 
user-supplied record whose namespace differs from the schema Beam generates 
from the table. The Avro message shows the union and the field values, not the 
two namespaces.
   - `AvroRowWriter` now recognizes that failure and throws 
`BigQueryRowSerializationException` naming both full names and pointing to 
`request.getSchema()` or `withAvroSchemaFactory`. Other append failures are 
unchanged.
   - This is the error-message option discussed on #19866. Records are still 
not rewritten to Beam's namespace.
   
   addresses #19866
   
   ## Test plan
   - [x] 
`BigQueryAvroUtilsTest.testNullableNestedRecordWithDifferentNamespaceFailsToWrite`
 reproduces Avro's `UnresolvedUnionException` for a nullable nested record with 
a different namespace.
   - [x] `BigQueryAvroUtilsTest.testAvroRowWriterReportsNamespaceMismatch` 
writes that record through `AvroRowWriter` and checks the message contains both 
`com.example.events.address` and `org.apache.beam.sdk.io.gcp.bigquery.address`.
   - [x] `:sdks:java:io:google-cloud-platform:compileJava` succeeds.
   
   
   Made with [Cursor](https://cursor.com)


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