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

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

KazydubB commented on pull request #1854: DRILL-7373: Fix problems involving 
reading from DICT type
URL: https://github.com/apache/drill/pull/1854#discussion_r324549150
 
 

 ##########
 File path: exec/vector/src/main/codegen/templates/BaseReader.java
 ##########
 @@ -83,6 +83,20 @@
      */
     int find(int key);
 
+    /**
+     * Obtain the index for given key in current row used to find a 
corresponding value with.
+     * Used in generated code when retrieving value from Dict using {@link 
org.apache.drill.common.expression.PathSegment}
+     * with provided {@link 
org.apache.drill.common.expression.PathSegment#getOriginalValue()}
+     * in cases when {@link 
org.apache.drill.exec.vector.complex.DictVector#getValueType()} is complex.
+     *
+     * <p>The {@code key} is assumed to be of actual type, is not converted 
and used as is.
+     *
+     * @param key key value
+     * @return index for the given key
+     * @see org.apache.drill.exec.vector.complex.DictVector
+     */
+    int find(Object key);
 
 Review comment:
   Yes, other methods are still used when there is no notion of column types 
during validation phase (when querying `DynamicDrillTable`, for example) based 
on `PathSegment` info (`int` for `ArraySegment` and `String` for 
`NamedSegment`).
 
----------------------------------------------------------------
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]


> Fix problems involving reading from DICT type
> ---------------------------------------------
>
>                 Key: DRILL-7373
>                 URL: https://issues.apache.org/jira/browse/DRILL-7373
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.17.0
>            Reporter: Bohdan Kazydub
>            Assignee: Bohdan Kazydub
>            Priority: Major
>             Fix For: 1.17.0
>
>
> Add better support for different key types ({{boolean}}, {{decimal}}, 
> {{float}}, {{double}} etc.) when retrieving values by key from {{DICT}} 
> column  when querying data source with known (during query validation phase) 
> field types (such as Hive table), so that actual key object instance  is 
> created in generated code and is passed to given {{DICT}} reader instead of 
> generating its value for every row based on {{int}} ({{ArraySegment}}) or 
> {{String}} ({{NamedSegment}}) value.
> This may be achieved by storing original literal value of passed key (as 
> {{Object}}) in {{PathSegment}} and its type (as {{MajorType}}) and using it 
> during code generation when reading {{DICT}}'s values by key in 
> {{EvaluationVisitor}}.
> Also, fix NPE when reading some cases involving reading values from {{DICT}} 
> and fix wrong result when reading complex structures using many ITEM 
> operators (i.e. , [] brackets), e.g. 
> {code}
> SELECT rid, mc.map_arr_map['key01'][1]['key01.1'] p16 FROM 
> hive.map_complex_tbl mc
> {code}
> where {{map_arr_map}} is of following type: {{MAP<STRING, ARRAY<MAP<STRING, 
> INT>>>}}



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

Reply via email to