ahmedabu98 commented on code in PR #30081:
URL: https://github.com/apache/beam/pull/30081#discussion_r1491458454
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/StorageApiConvertMessages.java:
##########
@@ -159,9 +178,20 @@ public void processElement(
.toMessage(element.getValue(), rowMutationInformation)
.withTimestamp(timestamp);
o.get(successfulWritesTag).output(KV.of(element.getKey(), payload));
- } catch (TableRowToStorageApiProto.SchemaConversionException e) {
- TableRow tableRow = messageConverter.toTableRow(element.getValue());
- o.get(failedWritesTag).output(new
BigQueryStorageApiInsertError(tableRow, e.toString()));
+ } catch (TableRowToStorageApiProto.SchemaConversionException
conversionException) {
+ TableRow tableRow;
+ try {
+ tableRow = messageConverter.toTableRow(element.getValue());
+ } catch (Exception e) {
+ badRecordRouter.route(
+ o, element, elementCoder, e, "Unable to convert value to
StorageWriteApiPayload");
+ return;
+ }
+ o.get(failedWritesTag)
+ .output(new BigQueryStorageApiInsertError(tableRow,
conversionException.toString()));
+ } catch (Exception e) {
+ badRecordRouter.route(
+ o, element, elementCoder, e, "Unable to convert value to
StorageWriteApiPayload");
Review Comment:
Ahh I see this is a catch for all other Exceptions (besides
`SchemaConversionException`). Nevermind this comment
--
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]