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

   **Please add a meaningful description for your change here**
   
   `ErrorFn` is constructed with `errorSchema = 
ErrorHandling.errorSchema(inputSchema)` and emits 
`ErrorHandling.errorRecord(errorSchema, row, e)`, so every row on `ERROR_TAG` 
carries that schema. The collection was then tagged with the wrapper applied a 
**second** time:
   
   ```java
   Schema errorSchema = ErrorHandling.errorSchema(inputSchema);          // :162
   ...
   new ErrorFn("TFRecord-write-error-counter", rowToBytesFn, errorSchema, 
handleErrors)
   ...
   
byteArrays.get(ERROR_TAG).setRowSchema(ErrorHandling.errorSchema(errorSchema)); 
  // :188
   ```
   
   `errorSchema(x)` is `{failed_row: Row(x), error_message: STRING}`, so the 
declared shape becomes `{failed_row: {failed_row: …, error_message: …}, 
error_message: …}` — which no element the transform produces can match.
   
   The sibling in the same package gets it right, five lines after an identical 
`ErrorFn` construction:
   
   ```java
   // TFRecordReadSchemaTransformProvider.java:140
   PCollection<Row> errorOutput = 
outputTuple.get(ERROR_TAG).setRowSchema(errorSchema);
   ```
   
   `JavaFilterTransformProvider`, `JavaMapToFieldsTransformProvider`, 
`PubsubRowToMessage`, `PubsubWriteSchemaTransformProvider` and 
`BigQueryStorageWriteApiSchemaTransformProvider` all do the same.
   
   ### Test
   
   One, and it needs no runner — the schema is fixed when the graph is built, 
so it runs in the ordinary `:sdks:java:core:test` task rather than under 
`NeedsRunner`.
   
   Restoring the second wrap fails it and nothing else:
   
   ```
   tests: 8, failures: 1
     FAILED: testWriteErrorSchemaMatchesTheRowsErrorFnEmits
   ```
   
   `spotlessJavaCheck`, `checkstyleMain` and `checkstyleTest` on 
`:sdks:java:core` are clean.
   
   ### Not in this PR
   
   `KafkaWriteSchemaTransformProvider.java:301` has the identical double wrap. 
It is in a different module with its own CI, so I have kept it separate rather 
than folding it in.
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us 
incorporate your contribution quickly and easily:
   
    - [x] Mention the appropriate issue in your description (for example: 
`addresses #123`), if applicable. This will automatically add a link to the 
pull request in the issue. If you would like the issue to automatically close 
on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
    - [x] Update `CHANGES.md` with noteworthy changes.
    - [x] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more 
tips on [how to make review process 
smoother](https://beam.apache.org/contribute/get-started-contributing/#make-the-reviewers-job-easier).
   
   To check the build health, please visit 
[https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
   
   GitHub Actions Tests Status (on master branch)
   
------------------------------------------------------------------------------------------------
   See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more 
information about GitHub Actions CI or the [workflows 
README](https://github.com/apache/beam/blob/master/.github/workflows/README.md) 
to see a list of phrases to trigger workflows.
   


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