hongbin ma created CALCITE-1351:
-----------------------------------

             Summary: "IS [NOT] NULL" operator should have higher precedence 
than "NOT" operator
                 Key: CALCITE-1351
                 URL: https://issues.apache.org/jira/browse/CALCITE-1351
             Project: Calcite
          Issue Type: Bug
    Affects Versions: 1.8.0
            Reporter: hongbin ma
            Assignee: Julian Hyde


hi calcite experts

when I run an auto-generated query(by BI tools):

{code:sql}
select "TEST_KYLIN_FACT"."LSTG_FORMAT_NAME", sum("TEST_KYLIN_FACT"."PRICE")   
from "DEFAULT"."TEST_KYLIN_FACT" "TEST_KYLIN_FACT"  group by 
"TEST_KYLIN_FACT"."LSTG_FORMAT_NAME" having  NOT sum("TEST_KYLIN_FACT"."PRICE") 
is null
{code}

the query failed due to : " Cannot apply 'NOT' to arguments of type 
'NOT<DECIMAL(19, 4)>'. Supported form(s): 'NOT<BOOLEAN>'"

however the same query would succeed in mysql. I guess calcite is giving "NOT" 
operation higher precedence than "IS NULL" operator.

Then I googled and found this page: 
https://docs.oracle.com/cd/A57673_01/DOC/server/doc/SQL73/ch3a.htm, it's 
oracle's standard, I'm quoting for as a reference. In this page, it says "All 
comparison operators" has a higher precedence than "NOT","AND","OR", and "IS 
[NOT] NULL" is one of the comparison operators.


With all the clues above I'm believing it's a calcite's bug. Please correct me 
if I'm wrong.



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

Reply via email to