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

 ##########
 File path: 
exec/vector/src/main/java/org/apache/drill/exec/vector/accessor/reader/UnionReaderImpl.java
 ##########
 @@ -268,4 +274,51 @@ public String getAsString() {
     }
     return requireReader(type).getAsString();
   }
+
+  private UnionReaderImpl getNullReader() {
+    AbstractObjectReader[] nullVariants = new 
AbstractObjectReader[variants.length];
+    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:
   Yes, this is for the case "where the `value` of a `key`/`value` pair is 
null". This `value` can be `null` for a given `key` if the `key` is not present 
in the dict for a given row (e.g. if you have a `Map<String, Integer>` with 
entry `"a" : 1` and you try to `Map#get("b")`, with `Map` being a Java map in 
the example). That is, the value may be non-nullable, but when you fetch a 
`value` by `key` and there is no entry for the given key (in a row) then this 
`Null*Reader` is used. The `Null*Reader`s are created in 
https://github.com/apache/drill/pull/1870/files#diff-da401fee5976aec49192b5fb6e22de3eR83.
 This structures are handled outside (of particular `DictReader`) so the 
structure is retained for uniformity. 
   The "dummy" readers are not projected (merely a placeholder, aren't they?), 
so this is not the way to use them(?).

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


With regards,
Apache Git Services

Reply via email to