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

Incorrect column ordering when CONVERT_FROM() json is used

    XMLWordPrintableJSON

Details

    Description

      For the following query, the column order in the results is wrong..it should be col1, col2, col3.

      0: jdbc:drill:zk=local> select 'abc' as col1, convert_from('{"x" : "y"}', 'json') as col2, 'xyz' as col3 from cp.`tpch/region.parquet`;
      +-------+-------+------------+
      | col1  | col3  |    col2    |
      +-------+-------+------------+
      | abc   | xyz   | {"x":"y"}  |
      | abc   | xyz   | {"x":"y"}  |
      | abc   | xyz   | {"x":"y"}  |
      | abc   | xyz   | {"x":"y"}  |
      | abc   | xyz   | {"x":"y"}  |
      +-------+-------+------------+
      

      The EXPLAIN plan:

      0: jdbc:drill:zk=local> explain plan for select 'abc' as col1, convert_from('{"x" : "y"}', 'json') as col2, 'xyz' as col3 from cp.`tpch/region.parquet`;
      +------+------+
      | text | json |
      +------+------+
      | 00-00    Screen
      00-01      Project(col1=['abc'], col2=[CONVERT_FROMJSON('{"x" : "y"}')], col3=['xyz'])
      00-02        Scan(groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath [path=classpath:/tpch/region.parquet]], selectionRoot=classpath:/tpch/region.parquet, numFiles=1, usedMetadataFile=false, columns=[]]])
      

      This happens on current master branch as well as 1.6.0 and even earlier (I checked 1.4.0 as well which also has the same behavior). So it is a pre-existing bug.

      Attachments

        Issue Links

          Activity

            People

              amansinha100 Aman Sinha
              amansinha100 Aman Sinha
              Chun Chang Chun Chang
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: