[ 
https://issues.apache.org/jira/browse/CALCITE-7304?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18081706#comment-18081706
 ] 

Yu Xu edited comment on CALCITE-7304 at 5/18/26 11:36 AM:
----------------------------------------------------------

My opinion is that this is a regression issue: The *RexSimplify.java* have 
overlooked handling of the *WEEK* type in canRollUp method that broke the 
simplification.

Some processing in the previous PR may have lacked boundary tests, which I 
temporarily disabled. I will continue to follow up and address this jira issue 
in next version. [~zabetak] 


was (Author: JIRAUSER307770):
My opinion is that this is a regression issue: The *RexSimplify.java* have 
overlooked handling of the *WEEK* type in canRollUp method.

Some processing in the previous PR may have lacked boundary tests, which I 
temporarily disabled. I will continue to follow up and address this jira issue 
in next version. [~zabetak] 

> Floor/Ceil can not simplify with WEEK TimeUnit
> ----------------------------------------------
>
>                 Key: CALCITE-7304
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7304
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.41.0
>            Reporter: Yu Xu
>            Assignee: Yu Xu
>            Priority: Minor
>              Labels: pull-request-available
>
> Since https://issues.apache.org/jira/browse/CALCITE-2178,  Floor function 
> would be simplify as:
> origin sql:
> {code:java}
> SELECT floor(floor(\"hire_date\" TO DAY) TO MONTH) FROM \"employee\" {code}
> would simplify to:
> {code:java}
> SELECT FLOOR(\"hire_date\" TO MONTH)\nFROM \"foodmart\".\"employee\" {code}
> but WEEK timeunit can not work well:
> origin sql:
> {code:java}
> SELECT floor(floor(\"hire_date\" TO DAY) TO WEEK) FROM \"employee\"{code}
> simplify without changing:
> {code:java}
> SELECT FLOOR((FLOOR(\"hire_date\" TO DAY)) TO WEEK)\nFROM 
> \"foodmart\".\"employee\" {code}
> expected simplify as :
> {code:java}
> SELECT FLOOR(\"hire_date\" TO WEEK)\nFROM \"foodmart\".\"employee\" {code}



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

Reply via email to