Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-1351

"IS [NOT] NULL" operator should have higher precedence than "NOT" operator

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.8.0
    • 1.9.0
    • None
    • None

    Description

      hi calcite experts

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

      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
      

      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.

      Attachments

        Issue Links

          Activity

            People

              julianhyde Julian Hyde
              mahongbin Hongbin Ma
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: