Github user Serhii-Harnyk commented on a diff in the pull request:

    https://github.com/apache/drill/pull/580#discussion_r98232198
  
    --- Diff: 
exec/vector/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java 
---
    @@ -317,6 +317,12 @@ public Object getObject(int index) {
             if (v != null && index < v.getAccessor().getValueCount()) {
               Object value = v.getAccessor().getObject(index);
               if (value != null) {
    +            if ((v.getAccessor().getObject(index) instanceof Map
    +                    && ((Map) v.getAccessor().getObject(index)).size() == 
0)
    +                || (v.getAccessor().getObject(index) instanceof List
    +                    && ((List) v.getAccessor().getObject(index)).size() == 
0)) {
    +              continue;
    +            }
    --- End diff --
    
    @paul-rogers, map fields have data mode required and they are the part of 
the schema, that's why there are no difference between missing field in some 
record, and the field that exists but empty. 
    This fix for your example will return result
    `{"a":{"b":10},"c":[1,2,3]}`
    `{"c":[4]}`
    `{"b":[5]}`
    `{"a":{"b":20}}`
    `{"a":{"b":20}}`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to