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

Arithmetic in Calcite does not produce results with the expected type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.36.0
    • None
    • core
    • None

    Description

      This seems to be a very old bug in Calcite, which appears in SqlOperatorTest under the name FNL25. It has been around for at least 10 years, but it affects other parts of the code as well. I could not find a more precise description of this bug in the JIRA, so I am filing a new one. I think this is at least a critical bug.

      The problem affects the expression evaluator in Calcite. After evaluating an arithmetic operation the result should be cast to the expected result type. For example, adding two SMALLINT values should cast the result to SMALLINT. Currently the code generated by the RexToLixTranslator is missing this cast. Since Java evaluation rules are different from SQL, many results are incorrect.

      Attachments

        Activity

          People

            Unassigned Unassigned
            mbudiu Mihai Budiu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: