Khurram Faraaz created DRILL-4943:
-------------------------------------

             Summary: need better error message  - DrillRuntimeException: 
Failure while materializing expression in constant expression evaluator
                 Key: DRILL-4943
                 URL: https://issues.apache.org/jira/browse/DRILL-4943
             Project: Apache Drill
          Issue Type: Bug
          Components: Execution - Data Types
    Affects Versions: 1.9.0
         Environment: Drill 1.9.0
            Reporter: Khurram Faraaz
            Priority: Minor


We need a better error message , rather than DrillRuntimeException

{noformat}
0: jdbc:drill:schema=dfs.tmp> SELECT case res1 WHEN true THEN res1 ELSE null END
. . . . . . . . . . . . . . > FROM
. . . . . . . . . . . . . . > (
. . . . . . . . . . . . . . >       SELECT
. . . . . . . . . . . . . . >          (CASE WHEN (false) THEN null ELSE 1 end) 
res1
. . . . . . . . . . . . . . >      FROM (values(1))
. . . . . . . . . . . . . . > );
Error: SYSTEM ERROR: DrillRuntimeException: Failure while materializing 
expression in constant expression evaluator [CASE(=(CASE(false, null, 1), 
true), CASE(false, null, 1), null)].  Errors:
Error in expression at index -1.  Error: Missing function implementation: 
[castINT(BIT-REQUIRED)].  Full expression: --UNKNOWN EXPRESSION--.


[Error Id: 1fba5a4e-89b6-415c-8982-97bf841869ef on centos-01.qa.lab:31010] 
(state=,code=0)
{noformat}

Calcite gives a very easy to understand message
{noformat}
0: jdbc:calcite:model=target/test-classes/mod> SELECT case res1 WHEN true THEN 
res1 ELSE null END
. . . . . . . . . . . . . . . . . . . . . . .> FROM
. . . . . . . . . . . . . . . . . . . . . . .> (
. . . . . . . . . . . . . . . . . . . . . . .>       SELECT
. . . . . . . . . . . . . . . . . . . . . . .>          (CASE WHEN (false) THEN 
null ELSE 1 end) res1
. . . . . . . . . . . . . . . . . . . . . . .>      FROM (values(1)) foo
. . . . . . . . . . . . . . . . . . . . . . .> ) foobar ;
Error: Error while executing SQL "SELECT case res1 WHEN true THEN res1 ELSE 
null END
FROM
(
      SELECT
         (CASE WHEN (false) THEN null ELSE 1 end) res1
     FROM (values(1)) foo
) foobar ": From line 1, column 8 to line 1, column 50: Cannot apply '=' to 
arguments of type '<INTEGER> = <BOOLEAN>'. Supported form(s): 
'<COMPARABLE_TYPE> = <COMPARABLE_TYPE>' (state=,code=0)
{noformat}



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

Reply via email to