[ https://issues.apache.org/jira/browse/DRILL-4936?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15683630#comment-15683630 ]
Serhii Harnyk commented on DRILL-4936: -------------------------------------- [~khfaraaz] There is a comment in Calcite code: // according to the sql standard we can not have all of the THEN // statements and the ELSE returning null I checked spec and looks they are right: ISO/IEC 9075-2:2011(E) 6.12 <case expression> - Syntax Rules: 3) At least one <result> in a <case specification> shall specify a <result expression> > case expression when true then null, fails > ------------------------------------------ > > Key: DRILL-4936 > URL: https://issues.apache.org/jira/browse/DRILL-4936 > Project: Apache Drill > Issue Type: Bug > Components: Execution - Flow > Affects Versions: 1.9.0 > Reporter: Khurram Faraaz > Assignee: Serhii Harnyk > > Postgres compile and executes same query and returns null, whereas Drill > returns error. > Drill 1.9.0 > git commit id : 4edabe7a > Drom Drill 1.9.0 > {noformat} > 0: jdbc:drill:schema=dfs.tmp> select (case when true then null else null end) > from (values(1)); > Error: VALIDATION ERROR: From line 1, column 9 to line 1, column 46: ELSE > clause or at least one THEN clause must be non-NULL > SQL Query null > [Error Id: 2912d0b5-b947-4cd7-b325-83c809e5ae50 on centos-01.qa.lab:31010] > (state=,code=0) > {noformat} > {noformat} > 0: jdbc:drill:schema=dfs.tmp> select (case when true then null end) from > (values(1)); > Error: VALIDATION ERROR: From line 1, column 9 to line 1, column 36: ELSE > clause or at least one THEN clause must be non-NULL > SQL Query null > [Error Id: cdb56929-b175-4474-b8a4-e6eec4d4a28f on centos-01.qa.lab:31010] > (state=,code=0) > {noformat} > from Postgres 9.3 > {noformat} > postgres=# select (case when true then null else null end) from (values(1)) > foo; > case > ------ > (1 row) > {noformat} > {noformat} > postgres=# select (case when true then null end) from (values(1)) foo; > case > ------ > (1 row) > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)