[ 
https://issues.apache.org/jira/browse/CALCITE-1793?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chris Baynes updated CALCITE-1793:
----------------------------------
    Description: 
EXTRACT_DATE was originally intended to be an internal function, always created 
by translating a call to EXTRACT.

Currently this makes the EXTRACT_DATE function rather awkward to use:

{code}
SqlOperator op = new SqlSpecialOperator("EXTRACT_DATE", SqlKind.EXTRACT, 2, 
true, ReturnTypes.INTEGER, null, null);
builder.call(op, builder.getRexBuilder().makeFlag(TimeUnitRange.YEAR), 
builder.field(1, 0, "my_date"));
{code}

[~julianhyde] suggests calling EXTRACT directly and then have RelBuilder invoke 
a convertlet to translate into calls to EXTRACT_DATE or date-time arithmetic.

Mailing list discussion:
[http://mail-archives.apache.org/mod_mbox/calcite-dev/201705.mbox/%3CCAPSgeET9OVWkvGsGXAezqhqP3Zd2dmXxs0k-J92WZM32%2BMq3kw%40mail.gmail.com%3E]

  was:
EXTRACT_DATE was originally intended to be an internal function, always created 
by translating a call to EXTRACT.

Currently this makes the EXTRACT_DATE function rather awkward to use:

{code}
SqlOperator op = new SqlSpecialOperator("EXTRACT_DATE", SqlKind.EXTRACT, 2, 
true, ReturnTypes.INTEGER, null, null);
builder.call(op, builder.getRexBuilder().makeFlag(TimeUnitRange.YEAR), 
builder.field(1, 0, "my_date"));
{code}

[~julianhyde] suggests calling EXTRACT directly and then have RelBuilder invoke 
a convertlet to translate into calls to EXTRACT_DATE or date-time arithmetic:
[http://mail-archives.apache.org/mod_mbox/calcite-dev/201705.mbox/%3CCAPSgeET9OVWkvGsGXAezqhqP3Zd2dmXxs0k-J92WZM32%2BMq3kw%40mail.gmail.com%3E]


> Allow RelBuilder to make calls to EXTRACT
> -----------------------------------------
>
>                 Key: CALCITE-1793
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1793
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.11.0, 1.12.0
>            Reporter: Chris Baynes
>            Assignee: Julian Hyde
>            Priority: Minor
>
> EXTRACT_DATE was originally intended to be an internal function, always 
> created by translating a call to EXTRACT.
> Currently this makes the EXTRACT_DATE function rather awkward to use:
> {code}
> SqlOperator op = new SqlSpecialOperator("EXTRACT_DATE", SqlKind.EXTRACT, 2, 
> true, ReturnTypes.INTEGER, null, null);
> builder.call(op, builder.getRexBuilder().makeFlag(TimeUnitRange.YEAR), 
> builder.field(1, 0, "my_date"));
> {code}
> [~julianhyde] suggests calling EXTRACT directly and then have RelBuilder 
> invoke a convertlet to translate into calls to EXTRACT_DATE or date-time 
> arithmetic.
> Mailing list discussion:
> [http://mail-archives.apache.org/mod_mbox/calcite-dev/201705.mbox/%3CCAPSgeET9OVWkvGsGXAezqhqP3Zd2dmXxs0k-J92WZM32%2BMq3kw%40mail.gmail.com%3E]



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to