hekk-kaori-maeda commented on PR #36832:
URL: https://github.com/apache/beam/pull/36832#issuecomment-3546397638
@stankiewicz
Thank you for the review!
I've updated the implementation to use `TableReference` instead of `String
tableUrn`, following the pattern used in `BigQueryInsertError`.
## Changes made:
1. **Changed to `TableReference` field**
- `BigQueryStorageApiInsertError` now uses `TableReference table`
instead of `String tableUrn`
- Removed custom parsing methods (`getProjectId()`, `getDatasetId()`,
`getTableId()`)
- Added `getTable()` method that returns `TableReference`
2. **Updated coder to use BigQueryHelpers**
- `encode()`: Uses `BigQueryHelpers.toTableSpec()` to convert
`TableReference` → `String`
- `decode()`: Uses `BigQueryHelpers.parseTableSpec()` to convert
`String` → `TableReference`
3. **Added null safety checks**
- Added null checks in the coder before calling `toTableSpec()` and
`parseTableSpec()`
- This prevents `NullPointerException` when table information is
unavailable
- Ensures pipeline stability even during error handling scenarios
4. **Updated all calling sites**
- All instantiation sites now pass `TableReference` from
`TableDestination.getTableReference()`
- Files updated: `StorageApiWriteUnshardedRecords.java`,
`StorageApiWritesShardedRecords.java`, `StorageApiConvertMessages.java`
- Added `TableReference` imports to modified files
5. **Updated toString() method**
- Added `table` field to the string representation for better debugging
visibility
- Ensures all fields are included in error logs
Ready for review.
--
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]