[
https://issues.apache.org/jira/browse/CALCITE-1124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15183132#comment-15183132
]
Arina Ielchiieva commented on CALCITE-1124:
-------------------------------------------
PR was updated.
1. When writing lacking unit tests, I have realized that converting timestamp
intervals to string, not a good idea, so I switched to SqlLiteral.createSymbol.
2. Added unit test in SqlParserTest.
3. Unit test in SqlOperatorBaseTest is not working, so currently it's ignored
using boolean enable check.
Test fails when RexToLixTranslator.translateCall
{code:java}
RexImpTable.INSTANCE.get(operator);
{code}
returns null which seems to be expected since timestampadd / diff are absent
rexImpltable.map and in BuiltInMethod enum. But I am not sure if we need to
update these classes.
Could you please suggest what to do here?
4. SqlOperatorBaseTest.testJdbc contains disabled tests for timestampadd /
diff. Can we delete them, since our two functions are not parsed through
SqlJdbcFunctionCall any more.
{code:java}
if (false) {
tester.checkScalar(
"{fn TIMESTAMPADD(interval, count, timestamp)}",
null,
"");
}
if (false) {
tester.checkScalar(
"{fn TIMESTAMPDIFF(interval, timestamp1, timestamp2)}",
null,
"");
}
{code}
5. Not sure if we need to add our two functions in
SqlJdbcFunction.JdbcToInternalLookupTable.map.
> Add support for timestampadd / timestampdiff functions
> ------------------------------------------------------
>
> Key: CALCITE-1124
> URL: https://issues.apache.org/jira/browse/CALCITE-1124
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Affects Versions: next
> Reporter: Arina Ielchiieva
> Assignee: Julian Hyde
> Labels: dialect
>
> When calling timestampadd / timestampdiff with first parameter:
> (SQL_TSI_)MICROSECOND ((SQL_TSI_)FRAC_SECOND (deprecated but we can leave for
> older versions compatibility)), (SQL_TSI_)SECOND, (SQL_TSI_)MINUTE,
> (SQL_TSI_)HOUR, (SQL_TSI_)DAY, (SQL_TSI_)WEEK, (SQL_TSI_)MONTH,
> (SQL_TSI_)QUARTER, (SQL_TSI_)YEAR
> (ex: timestampadd(second, 1, current_datetime), calcite throws an error:
> Caused by: org.apache.calcite.sql.parser.SqlParseException: Encountered "(
> SECOND" at line 1, column 25.
> Was expecting one of:
> "(" "*" ...
> "(" ")" ...
> "(" "WITH" ...
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)