You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@parquet.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/06/02 18:09:00 UTC

[jira] [Commented] (PARQUET-290) Add Avro data model to the reader builder

    [ https://issues.apache.org/jira/browse/PARQUET-290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17124162#comment-17124162 ] 

ASF GitHub Bot commented on PARQUET-290:
----------------------------------------

avinash-traceable commented on a change in pull request #204:
URL: https://github.com/apache/parquet-mr/pull/204#discussion_r434075774



##########
File path: parquet-avro/src/main/java/org/apache/parquet/avro/AvroParquetReader.java
##########
@@ -66,4 +69,47 @@ public AvroParquetReader(Configuration conf, Path file) throws IOException {
   public AvroParquetReader(Configuration conf, Path file, UnboundRecordFilter unboundRecordFilter) throws IOException {
     super(conf, file, new AvroReadSupport<T>(), unboundRecordFilter);
   }
+
+  public static class Builder<T> extends ParquetReader.Builder {
+
+    private GenericData model = null;
+    private boolean enableCompatibility = true;
+    private boolean isReflect = true;
+
+    private Builder(Path path) {
+      super(path);
+    }
+
+    public Builder<T> withDataModel(GenericData model) {
+      this.model = model;
+
+      // only generic and specific are supported by AvroIndexedRecordConverter
+      if (model.getClass() != GenericData.class &&
+          model.getClass() != SpecificData.class) {
+        isReflect = true;
+      }
+
+      return this;
+    }
+
+    public Builder<T> disableCompatibility() {
+      this.enableCompatibility = false;
+      return this;
+    }
+
+    public Builder<T> withCompatibility(boolean enableCompatibility) {
+      this.enableCompatibility = enableCompatibility;
+      return this;
+    }
+
+    @Override
+    protected ReadSupport<T> getReadSupport() {
+      if (isReflect) {

Review comment:
       isReflect is always true. Shouldn't it be false by default?
   The else below is unusable because of this.




----------------------------------------------------------------
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:
users@infra.apache.org


> Add Avro data model to the reader builder
> -----------------------------------------
>
>                 Key: PARQUET-290
>                 URL: https://issues.apache.org/jira/browse/PARQUET-290
>             Project: Parquet
>          Issue Type: Improvement
>          Components: parquet-avro
>    Affects Versions: 1.7.0
>            Reporter: Ryan Blue
>            Assignee: Ryan Blue
>            Priority: Major
>             Fix For: 1.8.0
>
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)