Deepika-lab opened a new pull request, #40266:
URL: https://github.com/apache/beam/pull/40266

   Fixes #20523
   
   A Beam schema field using the `NanosInstant` logical type 
(`beam:logical_type:nanos_instant:v1`, input type `java.time.Instant`) could 
not be written to BigQuery through schemas:
   
   - `BigQueryUtils.toTableSchema` (used by the BigQueryIO write path) threw 
`IllegalArgumentException: Cannot convert Beam logical type: 
beam:logical_type:nanos_instant:v1 to BigQuery type.`, because the identifier 
was missing from `BEAM_TO_BIGQUERY_LOGICAL_MAPPING`.
   - `BigQueryUtils.toTableRow` had no branch for the identifier, so the value 
fell through to `Object.toString()` instead of being formatted as a BigQuery 
TIMESTAMP.
   
   This change maps `NanosInstant` to BigQuery `TIMESTAMP` in 
`BEAM_TO_BIGQUERY_LOGICAL_MAPPING` and formats values with the existing 
`BigQueryAvroUtils.formatTimestamp`, consistent with how the micros-instant 
`Timestamp` logical type is handled.
   
   Tests:
   - Added `testToTableSchema_nanosInstant` and `testToTableRow_nanosInstant` 
to `BigQueryUtilsTest`.
   - Full `BigQueryUtilsTest`: 60 tests run, all pass. Before/after repro 
confirmed: previously `toTableSchema` threw and `toTableRow` emitted a raw ISO 
string; now the field maps to `TIMESTAMP` and formats as `2024-08-10 
16:52:07.123456789 UTC`.
   


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