drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chun Chang (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DRILL-1964) Missing key elements in returned array of maps
Date Thu, 08 Jan 2015 22:50:35 GMT
Chun Chang created DRILL-1964:
---------------------------------

             Summary: Missing key elements in returned array of maps
                 Key: DRILL-1964
                 URL: https://issues.apache.org/jira/browse/DRILL-1964
             Project: Apache Drill
          Issue Type: Bug
          Components: Storage - JSON
    Affects Versions: 0.8.0
            Reporter: Chun Chang
            Assignee: Hanifi Gunes
            Priority: Minor


#Wed Jan 07 18:54:07 EST 2015
git.commit.id.abbrev=35a350f

For an array of maps, if the schema for each map is not identical, with today's implementation,
we suppose to display each map with all elements (keys) from all maps. This is not happening.
For example, I have the following data:

{code}
{
    "id": 2,
    "oooa": {
        "oa": {
            "oab": {
                "oabc": [
                    {
                        "rowId": 2
                    },
                    {
                        "rowValue1": [{"rv1":1, "rv2":2}, {"rva1":3, "rva2":4}],
                        "rowValue2": [{"rw1":1, "rw2":2}, {"rwa1":3, "rwa2":4}]
                    }
                ]
            }
        }
    }
}
{code}

The following query gives:

{code}
0: jdbc:drill:schema=dfs.drillTestDirComplexJ> select t.oooa.oa.oab.oabc from `jira2file/jira1.json`
t;
+------------+
|   EXPR$0   |
+------------+
| [{"rowId":2,"rowValue1":[],"rowValue2":[]},{"rowValue1":[{"rv1":1,"rv2":2},{"rva1":3,"rva2":4}],"rowValue2":[{"rw1":1,"rw2":2},{"rwa1":3,"rwa2":4}]}]
|
+------------+
{code}

The returned result in a nicely formatted json form:

{code}
[
    {
        "rowId": 2,
        "rowValue1": [],
        "rowValue2": []
    },
    {
        "rowValue1": [
            {
                "rv1": 1,
                "rv2": 2
            },
            {
                "rva1": 3,
                "rva2": 4
            }
        ],
        "rowValue2": [
            {
                "rw1": 1,
                "rw2": 2
            },
            {
                "rwa1": 3,
                "rwa2": 4
            }
        ]
    }
]
{code}

Notice the first map includes all keys from all maps. But the second map is missing the "rowId"
key.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message