paul-rogers commented on a change in pull request #1870: DRILL-7359: Add 
support for DICT type in RowSet Framework
URL: https://github.com/apache/drill/pull/1870#discussion_r347114856
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/physical/resultSet/model/single/BaseReaderBuilder.java
 ##########
 @@ -77,22 +81,48 @@ protected AbstractObjectReader 
buildVectorReader(ValueVector vector, VectorDescr
     final MajorType type = va.type();
 
     switch(type.getMinorType()) {
-    case MAP:
-      return buildMap((AbstractMapVector) vector, va, type.getMode(), descrip);
-    case UNION:
-      return buildUnion((UnionVector) vector, va, descrip);
-    case LIST:
-      return buildList(vector, va, descrip);
-    case LATE:
-
-      // Occurs for a list with no type: a list of nulls.
-
-      return AbstractScalarReader.nullReader(descrip.metadata);
-    default:
-      return buildScalarReader(va, descrip.metadata);
+      case DICT:
+        return buildDict(vector, va, descrip);
+      case MAP:
+        return buildMap((AbstractMapVector) vector, va, type.getMode(), 
descrip);
+      case UNION:
+        return buildUnion((UnionVector) vector, va, descrip);
+      case LIST:
+        return buildList(vector, va, descrip);
+      case LATE:
+
+        // Occurs for a list with no type: a list of nulls.
+
+        return AbstractScalarReader.nullReader(descrip.metadata);
+      default:
+        return buildScalarReader(va, descrip.metadata);
     }
   }
 
+  private AbstractObjectReader buildDict(ValueVector vector, VectorAccessor 
va, VectorDescrip descrip) {
+
+    boolean isArray = descrip.metadata.isArray();
+
+    DictVector dictVector;
+    VectorAccessor dictAccessor;
+    if (isArray) {
 
 Review comment:
   It *should* be possible to let the column builder recursively build the 
readers for each of the two component fields, handling the details of arrays, 
lists. repeated lists and so on. That this code works is probably due to 
insufficient tests: do we have tests where the value is, say, a union, or a 
list (of unions), etc.?
   
   This is a very tricky bit of the code, took me forever to work out how to 
properly build nested structures.

----------------------------------------------------------------
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


With regards,
Apache Git Services

Reply via email to