ASF GitHub Bot commented on DRILL-7359:

KazydubB commented on pull request #1870: DRILL-7359: Add support for DICT type 
in RowSet Framework
URL: https://github.com/apache/drill/pull/1870#discussion_r353132642

 File path: 
 @@ -268,4 +274,51 @@ public String getAsString() {
     return requireReader(type).getAsString();
+  private UnionReaderImpl getNullReader() {
+    AbstractObjectReader[] nullVariants = new 
+    for (int i = 0; i < variants.length; i++) {
+      nullVariants[i] = variants[i].createNullReader();
+    }
+    return new NullUnionReader(schema(), unionAccessor, nullVariants);
+  }
+  private static class NullUnionReader extends UnionReaderImpl {
+    private NullUnionReader(ColumnMetadata metadata, VectorAccessor va, 
AbstractObjectReader[] variants) {
 Review comment:
   Regarding points of your suggestion:
   - `DictReaderImpl` has `NullStateReaders.REQUIRED_STATE_READER` 
`NullStateReader`, i.e. it can't be `NULL` (like `MapReader`).
   - `DICT` can't have `NULL` key as it is `REQUIRED`.
   - If the `DICT` has a key, but the value is `NULL`, then `isNull()` for the 
value returns `true` - yes.
   - in the (tricky) case of a missing key from the `DICT`, the latter approach 
was taken - there is no differentiation between missing key and `NULL` value. 
(The new `Null*Reader`s are introduced to be used in the case of a missing key 
- their `isNull()` always returns `true`; note, that in case when a key is 
present and the value is `NULL`, current (non-null) readers' `isNull()` will 
return `true` for that particular position, as corresponding value reader keeps 
track of nullability). The former approach was discarded to ensure uniform 
behavior without a chance of getting `NPE` or making `null`-checks.
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:

> Add support for DICT type in RowSet Framework
> ---------------------------------------------
>                 Key: DRILL-7359
>                 URL: https://issues.apache.org/jira/browse/DRILL-7359
>             Project: Apache Drill
>          Issue Type: New Feature
>            Reporter: Bohdan Kazydub
>            Assignee: Bohdan Kazydub
>            Priority: Major
>             Fix For: 1.17.0
> Add support for new DICT data type (see DRILL-7096) in RowSet Framework

This message was sent by Atlassian Jira

Reply via email to