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

Projecting a repeated map along with an order by results in an error

    XMLWordPrintableJSON

Details

    Description

      git.commit.id.abbrev=3e33880

      Data Set :

      {
          "uid": 1,
          "map": {
              "rm": [
                  {
                      "mapid": "m1",
                      "mapvalue": {
                          "col1": 1,
                          "col2": [0,1,2,3,4,5]
                      },
                      "rptd": [
                          { "a": "foo"},
                          { "b": "boo"}
                      ]
                  },
                  {
                      "mapid": "m2",
                      "mapvalue": {
                          "col1": 0,
                          "col2": []
                      },
                      "rptd": [
                          { "a": "bar"},
                          { "c": 1},
                          { "d": 4.5}
                      ]
                  }
              ]
          }
      }
      
      0: jdbc:drill:schema=dfs.drillTestDir> select s.uid, s.rms.rptd from (select d.uid, flatten(d.map.rm) rms from `data.json` d) s order by s.rms.mapid;
      Error: exception while executing query: null (state=,code=0)
      

      Explain Plan for the above query

      00-00    Screen
      00-01      Project(uid=[$0], EXPR$1=[$1])
      00-02        SelectionVectorRemover
      00-03          Sort(sort0=[$2], dir0=[ASC])
      00-04            Project(uid=[$0], EXPR$1=[ITEM($1, 'rptd')], EXPR$2=[ITEM($1, 'mapid')])
      00-05              Project(uid=[$0], rms=[$2])
      00-06                Flatten(flattenField=[$2])
      00-07                  Project(EXPR$0=[$0], EXPR$1=[$1], EXPR$2=[ITEM($1, 'rm')])
      00-08                    Scan(groupscan=[EasyGroupScan [selectionRoot=/drill/testdata/flatten_operators/temp2.json, numFiles=1, columns=[`uid`, `map`.`rm`], files=[maprfs:/drill/testdata/flatten_operators/data.json]]])
      

      However the below query works (It project an index in the repeated list)

      select s.uid, s.rms.rptd[0] from (select d.uid, flatten(d.map.rm) rms from `data.json` d) s order by s.rms.mapid;
      

      The logs are not entorely helpful here. Drill fails to propagate the error back for some reason. DRILL-2085 has been raised to track this

      2015-01-28 19:21:10,232 [2b36c959-3087-63d6-9a20-ca45fdb875f1:foreman] INFO  o.a.drill.exec.work.foreman.Foreman - State change requested.  PENDING --> RUNNING
      2015-01-28 19:21:10,320 [UserServer-1] INFO  o.a.drill.exec.work.foreman.Foreman - State change requested.  RUNNING --> CANCELED
      2015-01-28 19:21:10,336 [UserServer-1] INFO  o.a.drill.exec.work.foreman.Foreman - State change requested.  CANCELED --> COMPLETED
      2015-01-28 19:21:10,336 [UserServer-1] WARN  o.a.drill.exec.work.foreman.Foreman - Dropping request to move to COMPLETED state as query is already at CANCELED state (which is terminal).
      

      Attachments

        Activity

          People

            mehant Mehant Baid
            rkins Rahul Kumar Challapalli
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: