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

Can't parse DateFormat like 'YYYYMMDD' correctly in query

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • v1.2, v1.4.0
    • v1.2, v1.4.0
    • Query Engine
    • None

    Description

      Kylin has support date format as 'YYYYMMDD' since KYLIN-1101, and could read data and build cube successfully with this format.
      However, the query sql contains " dt='20151208' " can't be parsed, the reason is HBaseKeyRange.initPartitionRange still using default format 'YYYY-MM-DD' only, not read from partition desc.
      Here's the trace:

      Caused by: java.lang.IllegalArgumentException: '20150901' is not a valid date of pattern 'yyyy-MM-dd'
              at org.apache.kylin.common.util.DateFormat.stringToDate(DateFormat.java:78)
              at org.apache.kylin.common.util.DateFormat.stringToDate(DateFormat.java:70)
              at org.apache.kylin.storage.hbase.HBaseKeyRange.initPartitionRange(HBaseKeyRange.java:148)
              at org.apache.kylin.storage.hbase.HBaseKeyRange.init(HBaseKeyRange.java:127)
              at org.apache.kylin.storage.hbase.HBaseKeyRange.<init>(HBaseKeyRange.java:101)
              at org.apache.kylin.storage.hbase.CubeStorageEngine.buildScanRanges(CubeStorageEngine.java:410)
              at org.apache.kylin.storage.hbase.CubeStorageEngine.search(CubeStorageEngine.java:134)
              at org.apache.kylin.query.enumerator.CubeEnumerator.queryStorage(CubeEnumerator.java:149)
              at org.apache.kylin.query.enumerator.CubeEnumerator.moveNext(CubeEnumerator.java:74)
              at Baz$1$1.moveNext(Unknown Source)
              at org.apache.calcite.linq4j.EnumerableDefaults.groupBy_(EnumerableDefaults.java:737)
              at org.apache.calcite.linq4j.EnumerableDefaults.groupBy(EnumerableDefaults.java:677)
              at org.apache.calcite.linq4j.DefaultEnumerable.groupBy(DefaultEnumerable.java:301)
              at Baz.bind(Unknown Source)
              at org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:281)
              at org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:235)
              at org.apache.calcite.jdbc.CalciteMetaImpl.createIterable(CalciteMetaImpl.java:533)
              at org.apache.calcite.avatica.AvaticaResultSet.execute(AvaticaResultSet.java:184)
              at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:63)
              at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:42)
              at org.apache.calcite.avatica.AvaticaConnection$1.execute(AvaticaConnection.java:473)
              at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:566)
              at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:477)
              at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:109)
              ... 83 more
      Caused by: java.text.ParseException: Unparseable date: "20150901"
              at java.text.DateFormat.parse(DateFormat.java:366)
              at org.apache.kylin.common.util.DateFormat.stringToDate(DateFormat.java:76)
              ... 106 more
      

      Attachments

        1. KYLIN-1216-1.x-staging.patch
          2 kB
          Yerui Sun
        2. KYLIN-1216-2.x-staging.patch
          4 kB
          Yerui Sun

        Activity

          People

            sunyerui Yerui Sun
            sunyerui Yerui Sun
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: