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

alter session set `store.json.all_text_mode` does not work as documented

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.8.0
    • 0.8.0
    • Storage - JSON
    • None

    Description

      0: jdbc:drill:schema=dfs> select * from `big_numeric.json`;
      Query failed: Query stopped., Numeric value (14994882832830675451) out of range of long (-9223372036854775808 - 9223372036854775807)
       at [Source: org.apache.drill.exec.vector.complex.fn.JsonReader@44ccf380; line: 0, column: 29] [ 56abe952-c902-41ac-b23b-8f44929a7ddf on atsqa4-134.qa.lab:31010 ]
      Error: exception while executing query: Failure while executing query. (state=,code=0)
      
      0: jdbc:drill:schema=dfs> alter session set `store.json.all_text_mode`= true;
      +------------+------------+
      |     ok     |  summary   |
      +------------+------------+
      | true       | store.json.all_text_mode updated. |
      +------------+------------+
      1 row selected (0.04 seconds)
      
      
      0: jdbc:drill:schema=dfs> select * from sys.options where name like '%all_text_mode%';
      +------------+------------+------------+------------+------------+------------+------------+
      |    name    |    kind    |    type    |  num_val   | string_val |  bool_val  | float_val  |
      +------------+------------+------------+------------+------------+------------+------------+
      | store.mongo.all_text_mode | BOOLEAN    | SYSTEM     | null       | null       | false      | null       |
      | store.json.all_text_mode | BOOLEAN    | SYSTEM     | null       | null       | false      | null       |
      | store.json.all_text_mode | BOOLEAN    | SESSION    | null       | null       | true       | null       |
      +------------+------------+------------+------------+------------+------------+------------+
      3 rows selected (0.14 seconds)
      
      0: jdbc:drill:schema=dfs> select * from `big_numeric.json`;
      Query failed: Query stopped., Numeric value (14994882832830675451) out of range of long (-9223372036854775808 - 9223372036854775807)
       at [Source: org.apache.drill.exec.vector.complex.fn.JsonReader@62c6c127; line: 0, column: 29] [ 147edaa9-3969-433c-895a-636d99df108f on atsqa4-134.qa.lab:31010 ]
      Error: exception while executing query: Failure while executing query. (state=,code=0)
      

      When I set this parameter on a SYSTEM level, it seems to work correctly:

      0: jdbc:drill:schema=dfs> alter system set `store.json.all_text_mode`= true;
      +------------+------------+
      |     ok     |  summary   |
      +------------+------------+
      | true       | store.json.all_text_mode updated. |
      +------------+------------+
      1 row selected (0.079 seconds)
      0: jdbc:drill:schema=dfs> select * from `big_numeric.json`;
      +------------+
      |     a1     |
      +------------+
      | 14994882832830675451 |
      +------------+
      1 row selected (0.07 seconds)
      

      Other "ALTER SESSION" parameters that I tried and they seem to work:

      • alter session set `exec.errors.verbose`= true;
      • alter session set `planner.enable_hashjoin`=false;
      • alter session set `planner.enable_hashagg`=false;

      Not the same as DRILL-1769 (see below)

      0: jdbc:drill:schema=dfs> alter session set `planner.enable_hashagg`= false;
      +------------+------------+
      |     ok     |  summary   |
      +------------+------------+
      | true       | planner.enable_hashagg updated. |
      +------------+------------+
      1 row selected (0.038 seconds)
      
      0: jdbc:drill:schema=dfs> select * from sys.options where name like '%enable_hashagg%' order by name;
      +------------+------------+------------+------------+------------+------------+------------+
      |    name    |    kind    |    type    |  num_val   | string_val |  bool_val  | float_val  |
      +------------+------------+------------+------------+------------+------------+------------+
      | planner.enable_hashagg | BOOLEAN    | SYSTEM     | null       | null       | true       | null       |
      | planner.enable_hashagg | BOOLEAN    | SESSION    | null       | null       | false      | null       |
      +------------+------------+------------+------------+------------+------------+------------+
      2 rows selected (0.133 seconds)
      
      0: jdbc:drill:schema=dfs> explain plan for select avg(o_totalprice) from cp.`tpch/orders.parquet` group by o_orderdate ;
      +------------+------------+
      |    text    |    json    |
      +------------+------------+
      | 00-00    Screen
      00-01      Project(EXPR$0=[CAST(/(CastHigh(CASE(=($2, 0), null, $1)), $2)):ANY])
      00-02        StreamAgg(group=[{0}], agg#0=[$SUM0($1)], agg#1=[COUNT($1)])
      00-03          Sort(sort0=[$0], dir0=[ASC])
      00-04            Scan(groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath [path=/tpch/orders.parquet]], selectionRoot=/tpch/orders.parquet, numFiles=1, columns=[`o_orderdate`, `o_totalprice`]]])
      
      0: jdbc:drill:schema=dfs> alter session set `planner.enable_streamagg`= false;
      +------------+------------+
      |     ok     |  summary   |
      +------------+------------+
      | true       | planner.enable_streamagg updated. |
      +------------+------------+
      1 row selected (0.039 seconds)
      0: jdbc:drill:schema=dfs> alter session set `planner.enable_hashagg`= true;
      +------------+------------+
      |     ok     |  summary   |
      +------------+------------+
      | true       | planner.enable_hashagg updated. |
      +------------+------------+
      1 row selected (0.031 seconds)
      
      0: jdbc:drill:schema=dfs> explain plan for select avg(o_totalprice) from cp.`tpch/orders.parquet` group by o_orderdate ;
      +------------+------------+
      |    text    |    json    |
      +------------+------------+
      | 00-00    Screen
      00-01      Project(EXPR$0=[CAST(/(CastHigh(CASE(=($2, 0), null, $1)), $2)):ANY])
      00-02        HashAgg(group=[{0}], agg#0=[$SUM0($1)], agg#1=[COUNT($1)])
      00-03          Scan(groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath [path=/tpch/orders.parquet]], selectionRoot=/tpch/orders.parquet, numFiles=1, columns=[`o_orderdate`, `o_totalprice`]]])
      

      Attachments

        1. DRILL-1953.2.patch.txt
          4 kB
          Abdel Hakim Deneche
        2. DRILL-1953.1.patch.txt
          4 kB
          Abdel Hakim Deneche

        Activity

          People

            jaltekruse Jason Altekruse
            vicky Victoria Markman
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: