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

Flatten on CONVERT_FROM fails with ClassCastException if resultset is empty

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • None
    • 1.8.0
    • None
    • None

    Description

      Flatten failed to work on top of convert_from when the resultset is empty.

      For a HBase table like this:

      0: jdbc:drill:zk=localhost:5181> select convert_from(t.address.cities,'json') from hbase.`/tmp/flattentest` t;
      ----------------------------------------------------------------------------------

      EXPR$0

      ----------------------------------------------------------------------------------

      {"list":[{"city":"SunnyVale"},{"city":"Palo Alto"},{"city":"Mountain View"}]}
      {"list":[{"city":"Seattle"},{"city":"Bellevue"},{"city":"Renton"}]}
      {"list":[{"city":"Minneapolis"},{"city":"Falcon Heights"},{"city":"San Paul"}]}

      ----------------------------------------------------------------------------------

      Flatten works when row_key is in (1,2,3)
      0: jdbc:drill:zk=localhost:5181> select flatten(t1.json.list) from (select convert_from(t.address.cities,'json') json from hbase.`/tmp/flattentest` t where row_key=1) t1;
      ---------------------------

      EXPR$0

      ---------------------------

      {"city":"SunnyVale"}
      {"city":"Palo Alto"}
      {"city":"Mountain View"}

      ---------------------------

      But Flatten throws exception if the resultset is empty

      0: jdbc:drill:zk=localhost:5181> select flatten(t1.json.list) from (select convert_from(t.address.cities,'json') json from hbase.`/tmp/flattentest` t where row_key=4) t1;
      Error: SYSTEM ERROR: ClassCastException: Cannot cast org.apache.drill.exec.vector.NullableIntVector to org.apache.drill.exec.vector.complex.RepeatedValueVector

      Fragment 0:0

      [Error Id: 07fd0cab-d1e6-4259-bfec-ad80f02d93a2 on atsqa4-127.qa.lab:31010] (state=,code=0)

      Attachments

        Issue Links

          Activity

            People

              cshi Chunhui Shi
              cshi Chunhui Shi
              Rahul Kumar Challapalli Rahul Kumar Challapalli
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: