You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by "Roger Shi (JIRA)" <ji...@apache.org> on 2017/04/23 09:24:04 UTC

[jira] [Commented] (KYLIN-2538) extract(MONTH from CURRENT_DATE) cannot be selected as a column in sql

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

Roger Shi commented on KYLIN-2538:
----------------------------------

I suppose this query targets CI Data Model and Cube. If yes, CURRENT_DATE is not in the table. And count(*) should not in the query.
The refined query is "select extract(MONTH from CAL_DT) from test_kylin_fact" and it returns the expected result. Please let me know if I miss anything.

> extract(MONTH from CURRENT_DATE) cannot be selected as a column in sql
> ----------------------------------------------------------------------
>
>                 Key: KYLIN-2538
>                 URL: https://issues.apache.org/jira/browse/KYLIN-2538
>             Project: Kylin
>          Issue Type: Bug
>          Components: Query Engine
>            Reporter: Dong Li
>            Assignee: liyang
>
> This SQL will fail with exceptions:
> select extract(MONTH from CURRENT_DATE), count(*) from test_kylin_fact
> Error message:
> Error while executing SQL "select extract(MONTH from CURRENT_DATE), count(*) from test_kylin_fact LIMIT 50000": No TblColRef found in EXTRACT_DATE(FLAG(MONTH), Reinterpret(CURRENT_DATE))
> Stacktrace:
> Caused by: java.lang.IllegalStateException: No TblColRef found in EXTRACT_DATE(FLAG(MONTH), Reinterpret(CURRENT_DATE))
>         at org.apache.kylin.query.relnode.OLAPProjectRel.buildColumnRowType(OLAPProjectRel.java:132)
>         at org.apache.kylin.query.relnode.OLAPProjectRel.implementOLAP(OLAPProjectRel.java:117)
>         at org.apache.kylin.query.relnode.OLAPRel$OLAPImplementor.visitChild(OLAPRel.java:83)
>         at org.apache.kylin.query.relnode.OLAPLimitRel.implementOLAP(OLAPLimitRel.java:75)
>         at org.apache.kylin.query.relnode.OLAPRel$OLAPImplementor.visitChild(OLAPRel.java:83)
>         at org.apache.kylin.query.relnode.OLAPToEnumerableConverter.implement(OLAPToEnumerableConverter.java:85)
>         at org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.implementRoot(EnumerableRelImplementor.java:108)
>         at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:92)
>         at org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1248)
>         at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:306)
>         at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:203)



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