[
https://issues.apache.org/jira/browse/BEAM-8344?focusedWorklogId=323638&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-323638
]
ASF GitHub Bot logged work on BEAM-8344:
----------------------------------------
Author: ASF GitHub Bot
Created on: 04/Oct/19 18:11
Start Date: 04/Oct/19 18:11
Worklog Time Spent: 10m
Work Description: amaliujia commented on pull request #9721: [BEAM-8344]
Add inferSchema support in ParquetIO and refactor ParquetTableProvider
URL: https://github.com/apache/beam/pull/9721#discussion_r331624690
##########
File path:
sdks/java/io/parquet/src/main/java/org/apache/beam/sdk/io/parquet/ParquetIO.java
##########
@@ -122,15 +122,34 @@
* pattern).
*/
public static Read read(Schema schema) {
- return new AutoValue_ParquetIO_Read.Builder().setSchema(schema).build();
+ return new AutoValue_ParquetIO_Read.Builder()
+ .setSchema(schema)
+ .setInferBeamSchema(false)
+ .build();
}
/**
* Like {@link #read(Schema)}, but reads each file in a {@link PCollection}
of {@link
* org.apache.beam.sdk.io.FileIO.ReadableFile}, which allows more flexible
usage.
*/
public static ReadFiles readFiles(Schema schema) {
- return new
AutoValue_ParquetIO_ReadFiles.Builder().setSchema(schema).build();
+ return new AutoValue_ParquetIO_ReadFiles.Builder()
+ .setSchema(schema)
+ .setInferBeamSchema(false)
+ .build();
+ }
+
+ private static <T> PCollection<T> setBeamSchema(
+ PCollection<T> pc, Class<T> clazz, @Nullable Schema schema) {
+ org.apache.beam.sdk.schemas.Schema beamSchema =
+ org.apache.beam.sdk.schemas.utils.AvroUtils.getSchema(clazz, schema);
+ if (beamSchema != null) {
Review comment:
Because here you won't throw exception if there is not beamSchema, why not
just make "inforSchema" as a non-optional action so we don't need set the
boolean to control it?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 323638)
Time Spent: 20m (was: 10m)
> Add infer schema support in ParquetIO and refactor ParquetTableProvider
> -----------------------------------------------------------------------
>
> Key: BEAM-8344
> URL: https://issues.apache.org/jira/browse/BEAM-8344
> Project: Beam
> Issue Type: Improvement
> Components: dsl-sql, io-java-parquet
> Reporter: Vishwas
> Assignee: Vishwas
> Priority: Major
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Add support for inferring Beam Schema in ParquetIO.
> Refactor ParquetTable code to use Convert.rows().
> Remove unnecessary java class GenericRecordReadConverter.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)