You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Tanner Clary (Jira)" <ji...@apache.org> on 2023/03/21 20:28:00 UTC

[jira] [Created] (CALCITE-5600) Allow EXTRACT() to accept custom time frames

Tanner Clary created CALCITE-5600:
-------------------------------------

             Summary: Allow EXTRACT() to accept custom time frames
                 Key: CALCITE-5600
                 URL: https://issues.apache.org/jira/browse/CALCITE-5600
             Project: Calcite
          Issue Type: Improvement
            Reporter: Tanner Clary
            Assignee: Tanner Clary


This is a sibling issue of [CALCITE-5449]. 

The {{EXTRACT}} function does not currently accept custom time frames such as {{MINUTE15}}. There is some ambiguity regarding what behavior these time frames would produce. For instance, would {{EXTRACT(DAY21 ...)}} return the same answer as {{EXTRACT(WEEK3 ... )}}? 

One possible solution is to treat {{EXTRACT(UNIT(X) ..)}} as {{EXTRACT(UNIT ...) / X}}.

An advantage would be that a lot of the existing {{EXTRACT}} logic could be used, with an additional modulus operation performed to account for the X multiplier afterwards. 

Most likely this will not be implemented until after the resolution of CALCITE-5449 which should hopefully provide additional clarity (which I will update this case with) as to how best go about this. As always, comments and suggestions appreciated.



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