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

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

arina-ielchiieva commented on pull request #1829: DRILL-7096: Develop vector 
for canonical Map<K,V>
URL: https://github.com/apache/drill/pull/1829#discussion_r317077102
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/FieldIdUtil.java
 ##########
 @@ -196,18 +206,48 @@ public static TypedFieldId getFieldId(ValueVector 
vector, int id, SchemaPath exp
         return getFieldIdIfMatchesUnion((UnionVector) vector, builder, false, 
seg.getChild());
       }
     } else if (vector instanceof ListVector) {
-      ListVector list = (ListVector) vector;
       builder.intermediateType(vector.getField().getType());
       builder.addId(id);
-      return getFieldIdIfMatches(list, builder, true, 
expectedPath.getRootSegment().getChild());
-    } else
-    if (vector instanceof AbstractContainerVector) {
+      return getFieldIdIfMatches(vector, builder, true, 
expectedPath.getRootSegment().getChild(), 1);
+    } else if (vector instanceof DictVector) {
+      MajorType vectorType = vector.getField().getType();
+      builder.intermediateType(vectorType);
+      builder.addId(id);
+      if (seg.isLastPath()) {
+        builder.finalType(vectorType);
+        return builder.build();
+      } else {
+        PathSegment child = seg.getChild();
+        builder.remainder(child);
+        return getFieldIdIfMatches(vector, builder, false, 
expectedPath.getRootSegment().getChild(), 0);
+      }
+    } else if (vector instanceof AbstractContainerVector) {
       // we're looking for a multi path.
-      AbstractContainerVector c = (AbstractContainerVector) vector;
       builder.intermediateType(vector.getField().getType());
       builder.addId(id);
-      return getFieldIdIfMatches(c, builder, true, 
expectedPath.getRootSegment().getChild());
-
+      return getFieldIdIfMatches(vector, builder, true, 
expectedPath.getRootSegment().getChild(), 1);
+    } else if (vector instanceof RepeatedDictVector) {
+      MajorType vectorType = vector.getField().getType();
+      builder.intermediateType(vectorType);
+      builder.addId(id);
+      if (seg.isLastPath()) {
+        builder.finalType(vectorType);
+        return builder.build();
+      } else {
+        PathSegment child = seg.getChild();
+        if (!child.isArray()) {
+          // repeated map is accessed not by index, ignore?
 
 Review comment:
   ? 
 
----------------------------------------------------------------
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


> Develop vector for canonical Map<K,V>
> -------------------------------------
>
>                 Key: DRILL-7096
>                 URL: https://issues.apache.org/jira/browse/DRILL-7096
>             Project: Apache Drill
>          Issue Type: Sub-task
>            Reporter: Igor Guzenko
>            Assignee: Bohdan Kazydub
>            Priority: Major
>             Fix For: 1.17.0
>
>
> Canonical Map<K,V> datatype can be represented using combination of three 
> value vectors:
> keysVector - vector for storing keys of each map
> valuesVector - vector for storing values of each map
> offsetsVector - vector for storing of start indexes of next each map
> So it's not very hard to create such Map vector, but there is a major issue 
> with such map representation. It's hard to search maps values by key in such 
> vector, need to investigate some advanced techniques to make such search 
> efficient. Or find other more suitable options to represent map datatype in 
> world of vectors.
> After question about maps, Apache Arrow developers responded that for Java 
> they don't have real Map vector, for now they just have logical Map type 
> definition where they define Map like: List< Struct<key:key_type, 
> value:value_type> >. So implementation of value vector would be useful for 
> Arrow too.



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

Reply via email to