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

Numeric literal in an IN list is casted to decimal even when decimal type is disabled

    Details

      Description

      0: jdbc:drill:schema=dfs> select * from sys.options where name like '%decimal%';
      +------------+------------+------------+------------+------------+------------+------------+------------+
      |    name    |    kind    |    type    |   status   |  num_val   | string_val |  bool_val  | float_val  |
      +------------+------------+------------+------------+------------+------------+------------+------------+
      | planner.enable_decimal_data_type | BOOLEAN    | SYSTEM     | DEFAULT    | null       | null       | false      | null       |
      +------------+------------+------------+------------+------------+------------+------------+------------+
      1 row selected (0.212 seconds)
      

      In list that contains more than 20 numeric literals.
      We are casting number with the decimal point to decimal type even though decimal type is disabled:

      0: jdbc:drill:schema=dfs> explain plan including all attributes for select * from t1 where a1 in (1,2,3,4,5,6,7,8,9,0,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25.0);
      +------------+------------+
      |    text    |    json    |
      +------------+------------+
      | 00-00    Screen : rowType = RecordType(ANY *): rowcount = 10.0, cumulative cost = {24.0 rows, 158.0 cpu, 0.0 io, 0.0 network, 35.2 memory}, id = 4921
      00-01      Project(*=[$0]) : rowType = RecordType(ANY *): rowcount = 10.0, cumulative cost = {23.0 rows, 157.0 cpu, 0.0 io, 0.0 network, 35.2 memory}, id = 4920
      00-02        Project(T7¦¦*=[$0]) : rowType = RecordType(ANY T7¦¦*): rowcount = 10.0, cumulative cost = {23.0 rows, 157.0 cpu, 0.0 io, 0.0 network, 35.2 memory}, id = 4919
      00-03          HashJoin(condition=[=($2, $3)], joinType=[inner]) : rowType = RecordType(ANY T7¦¦*, ANY a1, ANY a10, DECIMAL(11, 1) ROW_VALUE): rowcount = 10.0, cumulative cost = {23.0 rows, 157.0 cpu, 0.0 io, 0.0 network, 35.2 memory}, id = 4918
      00-05            Project(T7¦¦*=[$0], a1=[$1], a10=[$1]) : rowType = RecordType(ANY T7¦¦*, ANY a1, ANY a10): rowcount = 10.0, cumulative cost = {10.0 rows, 20.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 4915
      00-07              Project(T7¦¦*=[$0], a1=[$1]) : rowType = RecordType(ANY T7¦¦*, ANY a1): rowcount = 10.0, cumulative cost = {10.0 rows, 20.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 4914
      00-08                Scan(groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath [path=maprfs:/drill/testdata/subqueries/t1]], selectionRoot=/drill/testdata/subqueries/t1, numFiles=1, columns=[`*`]]]) : rowType = (DrillRecordRow[*, a1]): rowcount = 10.0, cumulative cost = {10.0 rows, 20.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 4913
      00-04            HashAgg(group=[{0}]) : rowType = RecordType(DECIMAL(11, 1) ROW_VALUE): rowcount = 1.0, cumulative cost = {2.0 rows, 9.0 cpu, 0.0 io, 0.0 network, 17.6 memory}, id = 4917
      00-06              Values : rowType = RecordType(DECIMAL(11, 1) ROW_VALUE): rowcount = 1.0, cumulative cost = {1.0 rows, 1.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 4916
      

        Attachments

          Activity

            People

            • Assignee:
              mehant Mehant Baid
              Reporter:
              vicky Victoria Markman
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: