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

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

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

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
 ##########
 @@ -523,14 +516,43 @@ private HoldingContainer 
visitValueVectorReadExpression(ValueVectorReadExpressio
         eval.add(expr.invoke("setPosition").arg(recordIndex));
         int listNum = 0;
 
+        JVar valueIndex = eval.decl(generator.getModel().INT, "valueIndex", 
JExpr.lit(-1));
+
+        int depth = 0;
+        boolean isMap = e.getFieldId().isMap(depth);
+
         while (seg != null) {
           if (seg.isArray()) {
+
             // stop once we get to the last segment and the final type is 
neither complex nor repeated (map, list, repeated list).
             // In case of non-complex and non-repeated type, we return Holder, 
in stead of FieldReader.
             if (seg.isLastPath() && !complex && !repeated && !listVector) {
               break;
             }
 
+            depth++;
+
+            if (isMap) {
+              JExpression keyExpr = 
JExpr.lit(seg.getArraySegment().getIndex());
+
+              JVar dictReader = generator.declareClassField("dictReader", 
generator.getModel()._ref(BaseReader.DictReader.class));
 
 Review comment:
   Could you please also use FieldReader here to be consistent with the code in 
this method?
 
----------------------------------------------------------------
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]


> 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