[
https://issues.apache.org/jira/browse/CALCITE-5450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17652554#comment-17652554
]
Oliver Lee commented on CALCITE-5450:
-------------------------------------
Question: For the parser side, I was going to make a change similar to this:
[https://github.com/apache/calcite/blob/main/core/src/main/codegen/templates/Parser.jj#L5010]
to capture the correct {{TimeUnit}} operand, what should I put for the
TimeUnit return if I don't add to avatica?
(My avatica local changes was going to be to add in TimeUnits for the days of
week to differentiate)
Re: withEpoch, I have found that here:
[https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/rel/type/TimeFrames.java#L75]
if I just add
{quote}{{b.addSub("WEEK_MONDAY", false, 7, "DAY", new TimestampString(1970, 1,
5, 0, 0, 0));}}
{quote}
then adding a test here
[https://github.com/apache/calcite/blob/main/core/src/test/java/org/apache/calcite/test/TimeFrameTest.java#L220]
{quote}{{f.checkDateFloor("1970-08-04",
f.timeFrameSet.get("WEEK_MONDAY").unit(), is("1970-08-03"));}}
{quote}
succeeds, so I don't think I need withEpoch after all
> Add to parser WEEK(WEEKDAY) for custom time frames
> --------------------------------------------------
>
> Key: CALCITE-5450
> URL: https://issues.apache.org/jira/browse/CALCITE-5450
> Project: Calcite
> Issue Type: Improvement
> Reporter: Oliver Lee
> Priority: Minor
>
> Some BIG_QUERY functions (i.e. {{{}EXTRACT(){}}}, {{DATE_TRUNC()}} ) can
> accept the operand
> {{WEEK(WEEKDAY)}} where {{WEEKDAY}} is one of {{SUNDAY, MONDAY, TUESDAY,
> WEDNESDAY, THURSDAY, FRIDAY, SATURDAY}}
>
> This is not currently supported.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)