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

[jira] [Created] (DRILL-2001) Exception is thrown in arithmetic expression with MIN/MAX functions on a string type

Victoria Markman created DRILL-2001:
---------------------------------------

             Summary: Exception is thrown in arithmetic expression with MIN/MAX functions on a string type
                 Key: DRILL-2001
                 URL: https://issues.apache.org/jira/browse/DRILL-2001
             Project: Apache Drill
          Issue Type: Bug
    Affects Versions: 0.8.0
            Reporter: Victoria Markman
            Priority: Minor


We do support MIN/MAX(<string data type>).
However, if I inadvertently were to use this in arithmetic expression, I would get an exception:

{code}
{ "a1": "aaa" }
{ "a1": "bbb" }
{ "a1": "bbb" }
{ "a1": "eee" }
{code}

Works correctly:
{code}
0: jdbc:drill:schema=dfs> select max(a1) from `t.json`;
+------------+
|   EXPR$0   |
+------------+
| eee        |
+------------+
1 row selected (0.085 seconds)

0: jdbc:drill:schema=dfs> select min(a1) from `t.json`;
+------------+
|   EXPR$0   |
+------------+
| aaa        |
+------------+
1 row selected (0.104 seconds)
{code}

Throws an exception:

{code}
0: jdbc:drill:schema=dfs> select min(a1)+1 from `t.json`;
+------------+
|   EXPR$0   |
+------------+
Query failed: Query failed: Failure while running fragment., aaa [ 9194a73d-676d-4e63-8a49-a3c0ff0e63e0 on atsqa4-133.qa.lab:31010 ]
[ 9194a73d-676d-4e63-8a49-a3c0ff0e63e0 on atsqa4-133.qa.lab:31010 ]
java.lang.RuntimeException: java.sql.SQLException: Failure while executing query.
	at sqlline.SqlLine$IncrementalRows.hasNext(SqlLine.java:2514)
	at sqlline.SqlLine$TableOutputFormat.print(SqlLine.java:2148)
	at sqlline.SqlLine.print(SqlLine.java:1809)
	at sqlline.SqlLine$Commands.execute(SqlLine.java:3766)
	at sqlline.SqlLine$Commands.sql(SqlLine.java:3663)
	at sqlline.SqlLine.dispatch(SqlLine.java:889)
	at sqlline.SqlLine.begin(SqlLine.java:763)
	at sqlline.SqlLine.start(SqlLine.java:498)
	at sqlline.SqlLine.main(SqlLine.java:460)

0: jdbc:drill:schema=dfs> select max(a1)+1 from `t.json`;
+------------+
|   EXPR$0   |
+------------+
Query failed: Query failed: Failure while running fragment., eee [ 23d7d06d-b93b-4cb0-a35b-c0fa0faf3369 on atsqa4-133.qa.lab:31010 ]
[ 23d7d06d-b93b-4cb0-a35b-c0fa0faf3369 on atsqa4-133.qa.lab:31010 ]
java.lang.RuntimeException: java.sql.SQLException: Failure while executing query.
	at sqlline.SqlLine$IncrementalRows.hasNext(SqlLine.java:2514)
	at sqlline.SqlLine$TableOutputFormat.print(SqlLine.java:2148)
	at sqlline.SqlLine.print(SqlLine.java:1809)
	at sqlline.SqlLine$Commands.execute(SqlLine.java:3766)
	at sqlline.SqlLine$Commands.sql(SqlLine.java:3663)
	at sqlline.SqlLine.dispatch(SqlLine.java:889)
	at sqlline.SqlLine.begin(SqlLine.java:763)
	at sqlline.SqlLine.start(SqlLine.java:498)
	at sqlline.SqlLine.main(SqlLine.java:460)
{code}



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