Uploaded image for project: 'Kylin'
  1. Kylin
  2. KYLIN-2538

extract(MONTH from CURRENT_DATE) cannot be selected as a column in sql

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • Query Engine
    • None

    Description

      From calcite SQL reference: CURRENT_DATE is a const to get the value of current value.
      But in Kylin 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)

      Attachments

        Activity

          People

            liyang.gmt8@gmail.com liyang
            lidong_sjtu Dong Li
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: