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

TJ Banghart commented on CALCITE-5449:
--------------------------------------

We were looking into this a bit further and it seems like you already had a 
general solution for the type of unparsing problem mentioned above 
[~julianhyde].

[{{TimeFrameOperandHandler#rewriteCall}} 
|https://github.com/apache/calcite/blob/e2028ad85388eabe08c685c6672ceebbabd8f6ef/core/src/main/java/org/apache/calcite/sql/type/OperandHandlers.java#L78-L112]
 is already converting custom time frames into {{SqlIntervalQualifers}} that 
would be unparsed by {{SqlDialect#unparseSqlIntervalQualifier}}. We may be able 
to add these handlers to every operator that allows custom timeframes to ensure 
that they are treated as identifiers.

If the correct operand handler is provided, I believe we can get the behavior 
we want without a change to Avatica. 
{{ISOWEEK}} can be implemented in Calcite directly and I believe 
{{WEEK(WEEKDAY)}} is already working as expected.

> Allow EXTRACT() to accept ISOWEEK and WEEK(WEEKDAY)
> ---------------------------------------------------
>
>                 Key: CALCITE-5449
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5449
>             Project: Calcite
>          Issue Type: Sub-task
>            Reporter: Tanner Clary
>            Assignee: Tanner Clary
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Implement BigQuery {{EXTRACT()}} Function. {{EXTRACT(part FROM 
> date_expression)}} returns the value from the date_expression corresponding 
> to the specified part. Calcite currently supports PostgreSQL' {{DATE_PART}} 
> which has similar behavior.
> Example: {{SELECT EXTRACT(DAY FROM DATE '2013-12-25')}} would return 25.
> [BigQuery 
> Docs|https://g3doc.corp.google.com/company/teams/googlesql/reference/date_functions.md#extract
>  ]



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

Reply via email to