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

Improve message where implicit cast fails (e.g. with IN clause)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 0.7.0
    • Future
    • Execution - Data Types
    • None

    Description

      – Works, because value in "IN CLAUSE" is a compatible numeric type

      0: jdbc:drill:schema=dfs> select * from cp.`tpch/nation.parquet` where n_regionkey in (4);
      +-------------+------------+-------------+------------+
      | n_nationkey |   n_name   | n_regionkey | n_comment  |
      +-------------+------------+-------------+------------+
      | 4           | EGYPT      | 4           | y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d |
      | 10          | IRAN       | 4           | efully alongside of the slyly final dependencies.  |
      | 11          | IRAQ       | 4           | nic deposits boost atop the quickly final requests? quickly regula |
      | 13          | JORDAN     | 4           | ic deposits are blithely about the carefully regular pa |
      | 20          | SAUDI ARABIA | 4           | ts. silent requests haggle. closely express packages sleep across the blithely |
      +-------------+------------+-------------+------------+
      5 rows selected (0.092 seconds)
      

      – WORKS (trying to convert literal string to numeric and succeeds, because it can be implicitly converted)

      0: jdbc:drill:schema=dfs> select * from cp.`tpch/nation.parquet` where n_regionkey in ('4');
      +-------------+------------+-------------+------------+
      | n_nationkey |   n_name   | n_regionkey | n_comment  |
      +-------------+------------+-------------+------------+
      | 4           | EGYPT      | 4           | y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d |
      | 10          | IRAN       | 4           | efully alongside of the slyly final dependencies.  |
      | 11          | IRAQ       | 4           | nic deposits boost atop the quickly final requests? quickly regula |
      | 13          | JORDAN     | 4           | ic deposits are blithely about the carefully regular pa |
      | 20          | SAUDI ARABIA | 4           | ts. silent requests haggle. closely express packages sleep across the blithely |
      +-------------+------------+-------------+------------+
      5 rows selected (0.073 seconds)
      

      – FAILS (can't be converted to numeric type)

      0: jdbc:drill:schema=dfs> select * from cp.`tpch/nation.parquet` where n_regionkey in ('abc');
      Query failed: Query failed: Failure while running fragment., abc [ 4578a64c-75c5-4acf-be8c-28ce0db8623d on atsqa4-133.qa.lab:31010 ]
      [ 4578a64c-75c5-4acf-be8c-28ce0db8623d on atsqa4-133.qa.lab:31010 ]
      Error: exception while executing query: Failure while executing query. (state=,code=0)
      
      0: jdbc:drill:schema=dfs> select * from cp.`tpch/nation.parquet` where n_regionkey in ('4');
      +-------------+------------+-------------+------------+
      | n_nationkey |   n_name   | n_regionkey | n_comment  |
      +-------------+------------+-------------+------------+
      | 4           | EGYPT      | 4           | y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d |
      | 10          | IRAN       | 4           | efully alongside of the slyly final dependencies.  |
      | 11          | IRAQ       | 4           | nic deposits boost atop the quickly final requests? quickly regula |
      | 13          | JORDAN     | 4           | ic deposits are blithely about the carefully regular pa |
      | 20          | SAUDI ARABIA | 4           | ts. silent requests haggle. closely express packages sleep across the blithely |
      +-------------+------------+-------------+------------+
      5 rows selected (0.073 seconds)
      

      It would be really neat to get a descriptive error message.
      Postges example:

      postgres=# select * from t1 where c1 in ('abc');
      ERROR:  invalid input syntax for integer: "abc"
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            vicky Victoria Markman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: