[ 
https://issues.apache.org/jira/browse/PHOENIX-6823?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Istvan Toth updated PHOENIX-6823:
---------------------------------
    Description: 
 
{noformat}
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)
...{noformat}
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.

  was:
 
{noformat}
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)
...{noformat}
This is caused by getKeyRange not being updated when the Joda-based time units 
were added.

 


> calling Joda-based round() function on temporal PK field causes division by 
> zero error
> --------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-6823
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6823
>             Project: Phoenix
>          Issue Type: Bug
>          Components: core
>            Reporter: Istvan Toth
>            Assignee: Istvan Toth
>            Priority: Major
>
>  
> {noformat}
> 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)
> ...{noformat}
> 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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to