[jira] [Commented] (CALCITE-2178) Extend expression simplifier to work on datetime FLOOR functions
[ https://issues.apache.org/jira/browse/CALCITE-2178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16366060#comment-16366060 ] Julian Hyde commented on CALCITE-2178: -- One remaining quibble: it's not easy to tell from the code or the test what simplification you are performing. Add some comments, then +1 to commit. > Extend expression simplifier to work on datetime FLOOR functions > > > Key: CALCITE-2178 > URL: https://issues.apache.org/jira/browse/CALCITE-2178 > Project: Calcite > Issue Type: Improvement > Components: core >Reporter: Jesus Camacho Rodriguez >Assignee: Jesus Camacho Rodriguez >Priority: Major > Fix For: 1.16.0 > > > Extend expression simplifier to support: > {code} > FLOOR(FLOOR(CAST( '2010-01-10 00:00:00' AS TIMESTAMP) TO HOUR) TO DAY) => > FLOOR(CAST( '2010-01-10 00:00:00' AS TIMESTAMP) TO DAY) > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2178) Extend expression simplifier to work on datetime FLOOR functions
[ https://issues.apache.org/jira/browse/CALCITE-2178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16365106#comment-16365106 ] Jesus Camacho Rodriguez commented on CALCITE-2178: -- Thanks for the feedback [~julianhyde], I have updated the PR, could you take a look? Weeks should not be there indeed. I have rewritten the logic to use {{TimeUnit}} and I have added a method {{canRollUp}} that accounts for the fact that {{QUARTER}} is not in order in the enumeration. > Extend expression simplifier to work on datetime FLOOR functions > > > Key: CALCITE-2178 > URL: https://issues.apache.org/jira/browse/CALCITE-2178 > Project: Calcite > Issue Type: Improvement > Components: core >Reporter: Jesus Camacho Rodriguez >Assignee: Jesus Camacho Rodriguez >Priority: Major > Fix For: 1.16.0 > > > Extend expression simplifier to support: > {code} > FLOOR(FLOOR(CAST( '2010-01-10 00:00:00' AS TIMESTAMP) TO HOUR) TO DAY) => > FLOOR(CAST( '2010-01-10 00:00:00' AS TIMESTAMP) TO DAY) > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2178) Extend expression simplifier to work on datetime FLOOR functions
[ https://issues.apache.org/jira/browse/CALCITE-2178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16365051#comment-16365051 ] Julian Hyde commented on CALCITE-2178: -- Review comments: * Any time we add a feature for FLOOR, let's also do it for CEIL. They are duals. In the long run, doing it for just FLOOR makes things more complicated. * Time units are a partial order, not a total order. You cannot roll up weeks to months, nor months to weeks. So, comparing TimeUnitHierarchy.ordinal() is wrong. * I don't see the need for TimeUnitHierarchy. There is already org.apache.calcite.avatica.util.TimeUnit, which is very similar. It even contains details of the roll-up, like the multiplier between a unit and its parent unit. Rather than TimeUnitHierarchy, I'd add a method {{static boolean canRollUp(TimeUnit, TimeUnit)}}. Perhaps that could get added to Avatica eventually. > Extend expression simplifier to work on datetime FLOOR functions > > > Key: CALCITE-2178 > URL: https://issues.apache.org/jira/browse/CALCITE-2178 > Project: Calcite > Issue Type: Improvement > Components: core >Reporter: Jesus Camacho Rodriguez >Assignee: Jesus Camacho Rodriguez >Priority: Major > Fix For: 1.16.0 > > > Extend expression simplifier to support: > {code} > FLOOR(FLOOR(CAST( '2010-01-10 00:00:00' AS TIMESTAMP) TO HOUR) TO DAY) => > FLOOR(CAST( '2010-01-10 00:00:00' AS TIMESTAMP) TO DAY) > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2178) Extend expression simplifier to work on datetime FLOOR functions
[ https://issues.apache.org/jira/browse/CALCITE-2178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16364913#comment-16364913 ] Jesus Camacho Rodriguez commented on CALCITE-2178: -- [~julianhyde], could you take a look at it? This should go in before CALCITE-2179. https://github.com/apache/calcite/pull/628 Thanks > Extend expression simplifier to work on datetime FLOOR functions > > > Key: CALCITE-2178 > URL: https://issues.apache.org/jira/browse/CALCITE-2178 > Project: Calcite > Issue Type: Improvement > Components: core >Reporter: Jesus Camacho Rodriguez >Assignee: Jesus Camacho Rodriguez >Priority: Major > Fix For: 1.16.0 > > > Extend expression simplifier to support: > {code} > FLOOR(FLOOR(CAST( '2010-01-10 00:00:00' AS TIMESTAMP) TO HOUR) TO DAY) => > FLOOR(CAST( '2010-01-10 00:00:00' AS TIMESTAMP) TO DAY) > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)