Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-1964

Missing key elements in returned array of maps

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Not A Problem
    • 0.8.0
    • 0.9.0
    • Execution - Data Types
    • None

    Description

      #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:

      {
          "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}]
                          }
                      ]
                  }
              }
          }
      }
      

      The following query gives:

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

      The returned result in a nicely formatted json form:

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

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

      Attachments

        Activity

          People

            hgunes Hanifi Gunes
            cchang@maprtech.com Chun Chang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: