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

SimonAlexs resolved CALCITE-6134.
---------------------------------
    Resolution: Resolved

extend or edit this file for my logic:

`calcite/babel/src/main/codegen/includes/parserImpls.ftl`

> Can't parse custom function with name 'DATEADD' in babel
> --------------------------------------------------------
>
>                 Key: CALCITE-6134
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6134
>             Project: Calcite
>          Issue Type: Bug
>          Components: babel
>    Affects Versions: 1.36.0
>            Reporter: SimonAlexs
>            Priority: Major
>
> h4. *1. config*
>     I use SqlBabelParserImpl.FACTORY, and create SqlCustomOperatorTable.java 
> which extends org.apache.calcite.sql.fun.SqlStdOperatorTable.
> {code:java}
> Frameworks.newConfigBuilder()
>         .parserConfig(SqlParser.config()
>                 .withLex(Lex.MYSQL)
>                 .withCaseSensitive(false)
>                 .withConformance(SqlConformanceEnum.MYSQL_5)
>                 .withParserFactory(SqlBabelParserImpl.FACTORY)
>         )
>         .operatorTable(SqlCustomOperatorTable.instance()) {code}
>     In my SqlCustomOperatorTable, I define my custom function named with 
> 'DATEADD'. 
> h4. *2. error*
>     When i try the sql below, i got error as follows.
> {code:java}
> select dateadd(1698389166000, interval 1 year) {code}
> {code:java}
> Encountered "1698389166000" at line 1, column 16.
> Was expecting one of:
>     <IDENTIFIER> ...
>     <HYPHENATED_IDENTIFIER> ...
>     <QUOTED_IDENTIFIER> ...
>     <BACK_QUOTED_IDENTIFIER> ...
>     <BIG_QUERY_BACK_QUOTED_IDENTIFIER> ...
>     <BRACKET_QUOTED_IDENTIFIER> ...
>     <UNICODE_QUOTED_IDENTIFIER> ... {code}
>     Is 'DATEADD' a reserved word? Is there any method to let me create a 
> custom function with name 'DATEADD'?
>     Thanks for your help.



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

Reply via email to