Victoria Markman created DRILL-2805:
---------------------------------------

             Summary: Throw clear error message when maxdir/mindir UDFs are 
used in any other part of SQL, but where clause
                 Key: DRILL-2805
                 URL: https://issues.apache.org/jira/browse/DRILL-2805
             Project: Apache Drill
          Issue Type: Bug
    Affects Versions: 0.9.0
            Reporter: Victoria Markman


This  error message is not right. I think the problem here is that we are not 
allowing to use these UDFs in projection list, group by or order by.
Can we please have an error message that says that ?

{code}
0: jdbc:drill:schema=dfs> select maxdir('dfs.test', 'bigtable') from smalltable 
 group by maxdir('dfs.test', 'bigtable');

Query failed: SYSTEM ERROR: The partition explorer interface can only be used 
in functions that can be evaluated at planning time. Make sure that the 
planner.enable_constant_folding configuration option is set to true.
[6c9dd988-0960-4a3a-9495-535e245f0daa on atsqa4-134.qa.lab:31010]
Error: exception while executing query: Failure while executing query. 
(state=,code=0)
{code}

This is the correct way this error message is used:
{code}
0: jdbc:drill:schema=dfs> select * from smalltable where dir0 = 
maxdir('dfs.test', 'bigtable') and dir1 = mindir('dfs.test', 'bigtable/2016');
+------------+------------+------------+
|  columns   |    dir0    |    dir1    |
+------------+------------+------------+
+------------+------------+------------+
No rows selected (0.943 seconds)

0: jdbc:drill:schema=dfs> alter session set `planner.enable_constant_folding` = 
false;
+------------+------------+
|     ok     |  summary   |
+------------+------------+
| true       | planner.enable_constant_folding updated. |
+------------+------------+
1 row selected (0.108 seconds)

0: jdbc:drill:schema=dfs> select * from smalltable where dir0 = 
maxdir('dfs.test', 'bigtable') and dir1 = mindir('dfs.test', 'bigtable/2016');

Query failed: SYSTEM ERROR: The partition explorer interface can only be used 
in functions that can be evaluated at planning time. Make sure that the 
planner.enable_constant_folding configuration option is set to true.
[c22bad01-f9c7-43ba-b76c-8a11be518b40 on atsqa4-134.qa.lab:31010]
Error: exception while executing query: Failure while executing query. 
(state=,code=0)
{code}

Btw, I'm not sure I understand why we want to make constant folding 
configurable. Is the any benefit to not have it turned on ?



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

Reply via email to