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

Pavel Gubin edited comment on CALCITE-1987 at 9/14/17 1:02 PM:
---------------------------------------------------------------

Proposing [changes|https://github.com/apache/calcite/pull/539] according to 
[this comment on 
CALCITE-1793|https://issues.apache.org/jira/browse/CALCITE-1793?focusedCommentId=16031852&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16031852]

Actually EXTRACT_DATE internal function can be removed then. The logic moved to 
RexImpTable.ExtractImplementor.


was (Author: pavel gubin):
Proposing [changes|https://github.com/apache/calcite/pull/539] according to 
[this comment on 
CALCITE-1793|https://issues.apache.org/jira/browse/CALCITE-1793?focusedCommentId=16031852&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16031852]

> EXTRACT is not implemented for JDBC
> -----------------------------------
>
>                 Key: CALCITE-1987
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1987
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.14.0
>            Reporter: Pavel Gubin
>            Assignee: Julian Hyde
>
> The following test fails with exception being added to JdbcTest:
> {code:java}
>   @Test public void testExtractMonthFromTimestamp() {
>     CalciteAssert.that()
>         .with(CalciteAssert.Config.JDBC_FOODMART)
>         .query("select extract(month from \"birth_date\") as c \n"
>             + "from \"foodmart\".\"employee\" where \"employee_id\"=1")
>         .returns("C=8\n");
>   }
> {code}
> Note, that it is important to make select from real table and not using limit 
> so that planner tries to push EXTRACT to JdbcProject. But then it throws the 
> following exception ():
> {noformat}
> Caused by: java.sql.SQLException: Error while executing SQL "select 
> extract(month from "birth_date") as c 
> from "foodmart"."employee" where "employee_id"=1": class 
> org.apache.calcite.sql.SqlSyntax$6: SPECIAL
>       at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
>       at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
>       at 
> org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
>       at 
> org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:218)
>       at 
> org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:564)
>       ... 26 more
> Caused by: java.lang.UnsupportedOperationException: class 
> org.apache.calcite.sql.SqlSyntax$6: SPECIAL
>       at org.apache.calcite.util.Util.needToImplement(Util.java:923)
>       at org.apache.calcite.sql.SqlSyntax$6.unparse(SqlSyntax.java:116)
>       at org.apache.calcite.sql.SqlOperator.unparse(SqlOperator.java:332)
>       at 
> org.apache.calcite.sql.SqlDialect$BaseHandler.unparseCall(SqlDialect.java:733)
> ...
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to