evanchen852 commented on code in PR #41858:
URL: https://github.com/apache/beam/pull/41858#discussion_r4760011668


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/AvroRowWriter.java:
##########
@@ -56,7 +57,48 @@ public void write(T element) throws IOException, 
BigQueryRowSerializationExcepti
     } catch (Exception e) {
       throw new BigQueryRowSerializationException(e);
     }
-    writer.append(serializedRequest);
+    try {
+      writer.append(serializedRequest);
+    } catch (DataFileWriter.AppendWriteException e) {
+      org.apache.avro.UnresolvedUnionException unionError = 
findUnresolvedUnion(e);
+      if (unionError != null) {
+        throw new 
BigQueryRowSerializationException(namespaceMismatchMessage(unionError), e);

Review Comment:
   Updated the check so the namespace message is used only when the failed 
value is a record and the union has a record branch. Other 
UnresolvedUnionExceptions are rethrown as AppendWriteException.



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