You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "RustedBones (via GitHub)" <gi...@apache.org> on 2024/11/19 13:17:03 UTC
[PR] [java] BQ: use logical type in schema factory when enabled [beam]
RustedBones opened a new pull request, #33163:
URL: https://github.com/apache/beam/pull/33163
when writing to BQ with avro, if the table schema contains `DATE`, `TIME`, `TIMESTAMP` columns, the default schema factory should create avro fields with matching logical type.
There is still an issue with `DATETIME`: `BigQueryAvroUtils::toGenericAvroSchema` favored generating schema for the reading side and generates an avro filed with `string(datetime)` type. This can't be used on write (expecting `long(local-timestamp-millis)` or `long(local-timestamp-micros)`).
See note in [doc](https://cloud.google.com/bigquery/docs/loading-data-cloud-storage-avro#logical_types)
> When exporting to Avro from BigQuery, DATETIME is exported as a STRING with a custom logical time that is not recognized as a DATETIME upon importing back into BigQuery.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [java] BQ: use logical type in avro schema factory on write [beam]
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #33163:
URL: https://github.com/apache/beam/pull/33163#discussion_r1861124047
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java:
##########
@@ -3625,7 +3622,8 @@ private <DestinationT> WriteResult expandTyped(
hasSchema,
"A schema must be provided if an avroFormatFunction "
+ "is set but no avroSchemaFactory is defined.");
- avroSchemaFactory = DEFAULT_AVRO_SCHEMA_FACTORY;
+ avroSchemaFactory =
+ (tableSchema) -> BigQueryUtils.toGenericAvroSchema(tableSchema, true);
Review Comment:
aren't these no-op change?
BigQueryAvroUtils.toGenericAvroSchema(schema) calls BigQueryAvroUtils.toGenericAvroSchema(schema, true) calls BigQueryAvroUtils.toGenericAvroSchema("root", schema, true, namespace)
BigQueryUtils.toGenericAvroSchema(schema, true) calls BigQueryAvroUtils.toGenericAvroSchema("root", schema, true, namespace)
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [java] BQ: use logical type in avro schema factory on write [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #33163:
URL: https://github.com/apache/beam/pull/33163#issuecomment-2486217164
Assigning reviewers. If you would like to opt out of this review, comment `assign to next reviewer`:
R: @Abacn for label java.
R: @damondouglas for label io.
Available commands:
- `stop reviewer notifications` - opt out of the automated review tooling
- `remind me after tests pass` - tag the comment author after tests pass
- `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)
The PR bot will only process comments in the main thread (not review comments).
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [java] BQ: use logical type in avro schema factory on write [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #33163:
URL: https://github.com/apache/beam/pull/33163#issuecomment-2503723196
Reminder, please take a look at this pr: @Abacn @damondouglas
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [java] BQ: use logical type in avro schema factory on write [beam]
Posted by "RustedBones (via GitHub)" <gi...@apache.org>.
RustedBones commented on code in PR #33163:
URL: https://github.com/apache/beam/pull/33163#discussion_r1861744256
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java:
##########
@@ -3625,7 +3622,8 @@ private <DestinationT> WriteResult expandTyped(
hasSchema,
"A schema must be provided if an avroFormatFunction "
+ "is set but no avroSchemaFactory is defined.");
- avroSchemaFactory = DEFAULT_AVRO_SCHEMA_FACTORY;
+ avroSchemaFactory =
+ (tableSchema) -> BigQueryUtils.toGenericAvroSchema(tableSchema, true);
Review Comment:
Right, I messed up with `BigQueryUtils.toGenericAvroSchema` which has opposite default
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [java] BQ: use logical type in avro schema factory on write [beam]
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #33163:
URL: https://github.com/apache/beam/pull/33163#discussion_r1861124047
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java:
##########
@@ -3625,7 +3622,8 @@ private <DestinationT> WriteResult expandTyped(
hasSchema,
"A schema must be provided if an avroFormatFunction "
+ "is set but no avroSchemaFactory is defined.");
- avroSchemaFactory = DEFAULT_AVRO_SCHEMA_FACTORY;
+ avroSchemaFactory =
+ (tableSchema) -> BigQueryUtils.toGenericAvroSchema(tableSchema, true);
Review Comment:
aren't these no-op?
BigQueryAvroUtils.toGenericAvroSchema(schema) calls BigQueryAvroUtils.toGenericAvroSchema(schema, true) calls BigQueryAvroUtils.toGenericAvroSchema("root", schema, true, namespace)
BigQueryUtils.toGenericAvroSchema(schema, true) calls BigQueryAvroUtils.toGenericAvroSchema("root", schema, true, namespace)
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [java] BQ: use logical type in avro schema factory on write [beam]
Posted by "RustedBones (via GitHub)" <gi...@apache.org>.
RustedBones closed pull request #33163: [java] BQ: use logical type in avro schema factory on write
URL: https://github.com/apache/beam/pull/33163
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [java] BQ: use logical type in avro schema factory when enabled [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #33163:
URL: https://github.com/apache/beam/pull/33163#issuecomment-2485749601
Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment `assign set of reviewers`
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org