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

ASF GitHub Bot commented on DRILL-7376:
---------------------------------------

arina-ielchiieva commented on pull request #1856: DRILL-7376: Drill ignores 
Hive schema for MaprDB tables when group scan has star column
URL: https://github.com/apache/drill/pull/1856#discussion_r324533582
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/fn/JsonReaderUtils.java
 ##########
 @@ -120,4 +95,100 @@ public static void 
ensureAtLeastOneField(BaseWriter.ComplexWriter writer,
       }
     }
   }
+
+  /**
+   * Creates writers which correspond to the specified schema for specified 
root writer.
+   *
+   * @param writer      parent writer for writers to create
+   * @param columns     collection of columns for which writers should be 
created
+   * @param schema      table schema
+   * @param allTextMode whether all primitive writes should be for varchar type
+   */
+  public static void writeColumnsFromSchema(BaseWriter.ComplexWriter writer,
+      Collection<SchemaPath> columns, TupleMetadata schema, boolean 
allTextMode) {
+    Preconditions.checkArgument(schema != null, "Schema was not provided");
+    BaseWriter.MapWriter mapWriter = writer.rootAsMap();
+    for (SchemaPath column : columns) {
+      if (column.isDynamicStar()) {
+        writeColumnsForSchema(mapWriter, schema, allTextMode);
+      } else {
+        ColumnMetadata columnMetadata = 
schema.metadata(column.getRootSegmentPath());
+        writeToMap(mapWriter, column.getRootSegment(), columnMetadata, 
allTextMode);
+      }
+    }
+  }
+
+  private static void writeToMap(BaseWriter.MapWriter writer,
 
 Review comment:
   Please reconsider naming and add java doc for all methods below.
   Namings are confusing `writeToMap` vs `writeWithArray`, 
`writeColumnsFromSchema ` vs `writeColumnsForSchema`, it is not clear 
correlation between to / with, from / for.
   Is better to have method that indicates what type of column is written 
rather than overloaded `writeColumn`, this way user can see from code what 
column will be written.
 
----------------------------------------------------------------
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:
us...@infra.apache.org


> Drill ignores Hive schema for MaprDB tables when group scan has star column
> ---------------------------------------------------------------------------
>
>                 Key: DRILL-7376
>                 URL: https://issues.apache.org/jira/browse/DRILL-7376
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.17.0
>            Reporter: Volodymyr Vysotskyi
>            Assignee: Volodymyr Vysotskyi
>            Priority: Major
>             Fix For: 1.17.0
>
>
> For the case when group scan has star column, fix for DRILL-7369 doesn't work 
> and hive schema is ignored.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to