drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paul-rogers <...@git.apache.org>
Subject [GitHub] drill pull request #580: DRILL-4824: JSON with complex nested data produces ...
Date Tue, 13 Sep 2016 01:44:44 GMT
Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/580#discussion_r78484822
  
    --- 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 --
    
    Does this handle the difference beteen a missing field, and a field that exists, but contains
an empty map or list? Examples:
    
        { "a" : { "b" : 10 }, "c" : [ 1, 2, 3 ] }  // Baseline case
        { "a" : { }, "c" : [ 4 ] }                       // Keep "a"?
        { "b" : [ 5 ] }                                     // Remove a: OK
        { "a" : { "b": 20 }, "c" : [ ] }             // Keep "c"?
        { "a" : { "b": 20 } }                           // Remove c: OK
    
    That is, should we diffentiate between a empty map/list and a non-existent one?
    
    The code seems to discard all empty maps & lists. Should the check actually be done
in the parser to not pass along empty items? Is this possible (I'm on thin ice here in my
detailed knowledge of value vectors...)


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message