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

Json support lists of different types

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Trivial
    • Resolution: Unresolved
    • 1.16.0
    • None
    • Documentation
    • None

    Description

      With a file.json like

      {
          "name": "toto",
          "info": [["LOAD", []]],
          "response": 1
      }
      

      A simple SELECT gives an error

      apache drill> SELECT * FROM dfs.test.`file.json`;
      Error: UNSUPPORTED_OPERATION ERROR: In a list of type VARCHAR, encountered a value of type LIST. Drill does not support lists of different types.
      

      But there is an option exec.enable_union_type that allows these request

      apache drill> ALTER SESSION SET `exec.enable_union_type` = true;
      apache drill> SELECT * FROM dfs.test.`file.json`;
      +------+---------------+----------+
      | name |     info      | response |
      +------+---------------+----------+
      | toto | [["LOAD",[]]] | 1        |
      +------+---------------+----------+
      1 row selected (0.283 seconds)
      

      The usage of this option is not evident. So, it will be useful to mention after the error message the possibility to set it.

      Error: UNSUPPORTED_OPERATION ERROR: In a list of type VARCHAR, encountered a value of type LIST. Drill does not support lists of different types. .... SET the option 'exec.enable_union_type' to true and try again;
      

      This behaviour is used for other error, example:

      ...
      Error: UNSUPPORTED_OPERATION ERROR: This query cannot be planned possibly due to either a cartesian join or an inequality join. 
      If a cartesian or inequality join is used intentionally, set the option 'planner.enable_nljoin_for_scalar_only' to false and try again.
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            benj641 benj
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: