You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Victoria Markman (JIRA)" <ji...@apache.org> on 2014/12/19 01:13:13 UTC

[jira] [Updated] (DRILL-1895) Exception is thrown when type value in the "IN clause" is incompatible with the column type

     [ https://issues.apache.org/jira/browse/DRILL-1895?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Victoria Markman updated DRILL-1895:
------------------------------------
    Description: 
-- Works, because value in "IN CLAUSE" is a compatible numeric type
{code}
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)
{code}

-- WORKS (trying to convert literal string to numeric and succeeds, because it can be implicitly converted)
{code}
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)
{code}

-- FAILS (can't be converted to numeric type)
{code}
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)
{code}

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

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

  was:
-- 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 (suprisingly is 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)

Error message would be really neat.
Postges example:

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



> Exception is thrown when type value in the "IN clause" is incompatible with the column type
> -------------------------------------------------------------------------------------------
>
>                 Key: DRILL-1895
>                 URL: https://issues.apache.org/jira/browse/DRILL-1895
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Execution - Data Types
>    Affects Versions: 0.7.0
>            Reporter: Victoria Markman
>
> -- Works, because value in "IN CLAUSE" is a compatible numeric type
> {code}
> 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)
> {code}
> -- WORKS (trying to convert literal string to numeric and succeeds, because it can be implicitly converted)
> {code}
> 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)
> {code}
> -- FAILS (can't be converted to numeric type)
> {code}
> 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)
> {code}
> It would be really neat to get a descriptive error message.
> Postges example:
> {code}
> postgres=# select * from t1 where c1 in ('abc');
> ERROR:  invalid input syntax for integer: "abc"
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)