RustedBones commented on code in PR #27971:
URL: https://github.com/apache/beam/pull/27971#discussion_r1291557536
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQuerySourceBase.java:
##########
@@ -237,29 +246,36 @@ private List<ResourceId> executeExtract(
List<BoundedSource<T>> createSources(
List<ResourceId> files, TableSchema schema, @Nullable
List<MatchResult.Metadata> metadata)
throws IOException, InterruptedException {
- String avroSchema =
- BigQueryAvroUtils.toGenericAvroSchema("root",
schema.getFields()).toString();
-
- AvroSource.DatumReaderFactory<T> factory = readerFactory.apply(schema);
+ String readerSchema =
+ avroSchema == null
+ ? BigQueryAvroUtils.toGenericAvroSchema("root",
schema.getFields()).toString()
+ : avroSchema;
- List<BoundedSource<T>> avroSources = Lists.newArrayList();
+ List<AvroSource<GenericRecord, GenericRecord>> avroSources =
Lists.newArrayList();
// If metadata is available, create AvroSources with said metadata in
SINGLE_FILE_OR_SUBRANGE
// mode.
if (metadata != null) {
for (MatchResult.Metadata file : metadata) {
- avroSources.add(
- (AvroSource<T>)
-
AvroSource.from(file).withSchema(avroSchema).withDatumReaderFactory(factory));
+ avroSources.add(AvroSource.from(file));
}
} else {
for (ResourceId file : files) {
- avroSources.add(
- (AvroSource<T>)
- AvroSource.from(file.toString())
- .withSchema(avroSchema)
- .withDatumReaderFactory(factory));
Review Comment:
Here the factory returns a type T and coder is not propagated
--
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]