johnjcasey commented on code in PR #30081:
URL: https://github.com/apache/beam/pull/30081#discussion_r1491371248
##########
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");
Review Comment:
good catch
##########
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:
The error comment here refers to why the exception happened. We shouldn't be
able to fail to route to a dlq
--
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]