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

kvgen does not work with nested map/unions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.7.0
    • 0.7.0
    • Functions - Drill
    • None

    Description

      Tested on latest 0.7.0.

      kvgen function does not work well with nested maps/unions.

      1. This works fine:

      $ cat test_work.json
      {
        "data" : {
          "col1" :  "aaa"
        }
      }
      
       
      0: jdbc:drill:zk=local> select kvgen(tab.data) from `test_work.json` tab;
      +------------+
      |   EXPR$0   |
      +------------+
      | [{"key":"col1","value":"aaa"}] |
      +------------+
      1 row selected (0.034 seconds)
      

      2. This failed:

      $ cat test7.json
      {
        "data" : {
          "col1" : {
            "one" : "aaa" 
          }
        }
      }
      
      
      0: jdbc:drill:zk=local> select kvgen(tab.data) from `test7.json` tab;
      +------------+
      |   EXPR$0   |
      +------------+
      Query failed: Failure while running fragment., Mappify does not support input of type: MAP [ d2bfea52-9935-4d63-8ecc-52315a3c7c7b on 10.250.0.115:31010 ]
      
      
      java.lang.RuntimeException: java.sql.SQLException: Failure while executing query.
      	at sqlline.SqlLine$IncrementalRows.hasNext(SqlLine.java:2514)
      	at sqlline.SqlLine$TableOutputFormat.print(SqlLine.java:2148)
      	at sqlline.SqlLine.print(SqlLine.java:1809)
      	at sqlline.SqlLine$Commands.execute(SqlLine.java:3766)
      	at sqlline.SqlLine$Commands.sql(SqlLine.java:3663)
      	at sqlline.SqlLine.dispatch(SqlLine.java:889)
      	at sqlline.SqlLine.begin(SqlLine.java:763)
      	at sqlline.SqlLine.start(SqlLine.java:498)
      	at sqlline.SqlLine.main(SqlLine.java:460)
      
      

      Attachments

        1. DRILL-1741.patch
          21 kB
          Mehant Baid

        Activity

          People

            cchang@maprtech.com Chun Chang
            haozhu Hao Zhu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: