Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-6823

calling Joda-based round() function on temporal PK field causes division by zero error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.2.0, 5.1.2
    • 5.2.0, 5.1.3
    • core
    • None
    • Fixed division by zero errors, and incorrect results when using round(), ceiling(), floor() functions in the where clause on date/time fields that are part of the primary key.

    Description

       

      0: jdbc:phoenix:> create table bubu (df date primary key);
      No rows affected (0.689 seconds)
      0: jdbc:phoenix:> select * from bubu where round(df,'YEAR',1)=DATE '2022-01-01 00:00:00';
      java.lang.ArithmeticException: / by zero
          at org.apache.phoenix.expression.function.RoundDateExpression$1.getKeyRange(RoundDateExpression.java:272)
      ...

      This is caused by getKeyRange not being updated when the Joda-based time units were added.

      Also, the keyrange pushdown logic is just wrong, even for the non-joda cases.

      Attachments

        Issue Links

          Activity

            People

              stoty Istvan Toth
              stoty Istvan Toth
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: