Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-1769

Exception thrown when TO_DATE function used as LHS in WHERE-clause

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.3.0
    • 4.7.0
    • None

    Description

      I want to compare DATE type that converted from VARCHAR type using TO_DATE().

      Query :

      select BIRTH from yunsh where TO_DATE(BIRTH) > TO_DATE('2001-01-01');

      BIRTH field is VARCHAR(50) type.

      But, it thrown exception below:

      Mon Mar 23 15:37:53 KST 2015, org.apache.hadoop.hbase.client.RpcRetryingCaller@4ef6823, java.io.IOException: java.io.IOException: java.lang.reflect.InvocationTargetException
      at org.apache.hadoop.hbase.protobuf.ProtobufUtil.toFilter(ProtobufUtil.java:1362)
      at org.apache.hadoop.hbase.protobuf.ProtobufUtil.toScan(ProtobufUtil.java:917)
      at org.apache.hadoop.hbase.regionserver.HRegionServer.scan(HRegionServer.java:3078)
      at org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:29497)
      at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2027)
      at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:98)
      at org.apache.hadoop.hbase.ipc.RpcExecutor.consumerLoop(RpcExecutor.java:114)
      at org.apache.hadoop.hbase.ipc.RpcExecutor$1.run(RpcExecutor.java:94)
      at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.reflect.InvocationTargetException
      at sun.reflect.GeneratedMethodAccessor110.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.apache.hadoop.hbase.protobuf.ProtobufUtil.toFilter(ProtobufUtil.java:1360)
      ... 8 more
      Caused by: org.apache.hadoop.hbase.exceptions.DeserializationException: java.io.IOException: java.lang.reflect.InvocationTargetException
      at org.apache.hadoop.hbase.filter.FilterList.parseFrom(FilterList.java:406)
      ... 12 more
      Caused by: java.io.IOException: java.lang.reflect.InvocationTargetException
      at org.apache.hadoop.hbase.protobuf.ProtobufUtil.toFilter(ProtobufUtil.java:1362)
      at org.apache.hadoop.hbase.filter.FilterList.parseFrom(FilterList.java:403)
      ... 12 more
      Caused by: java.lang.reflect.InvocationTargetException
      at sun.reflect.GeneratedMethodAccessor125.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.apache.hadoop.hbase.protobuf.ProtobufUtil.toFilter(ProtobufUtil.java:1360)
      ... 13 more
      Caused by: org.apache.hadoop.hbase.exceptions.DeserializationException: org.apache.hadoop.hbase.DoNotRetryIOException: BooleanExpressionFilter failed during reading: Could not initialize class org.apache.phoenix.util.DateUtil$ISODateFormatParser
      at org.apache.phoenix.filter.SingleCQKeyValueComparisonFilter.parseFrom(SingleCQKeyValueComparisonFilter.java:55)
      ... 17 more
      Caused by: org.apache.hadoop.hbase.DoNotRetryIOException: BooleanExpressionFilter failed during reading: Could not initialize class org.apache.phoenix.util.DateUtil$ISODateFormatParser
      at org.apache.phoenix.util.ServerUtil.createIOException(ServerUtil.java:84)
      at org.apache.phoenix.util.ServerUtil.throwIOException(ServerUtil.java:52)
      at org.apache.phoenix.filter.BooleanExpressionFilter.readFields(BooleanExpressionFilter.java:108)
      at org.apache.phoenix.filter.SingleKeyValueComparisonFilter.readFields(SingleKeyValueComparisonFilter.java:136)
      at org.apache.hadoop.hbase.util.Writables.getWritable(Writables.java:131)
      at org.apache.hadoop.hbase.util.Writables.getWritable(Writables.java:101)
      at org.apache.phoenix.filter.SingleCQKeyValueComparisonFilter.parseFrom(SingleCQKeyValueComparisonFilter.java:53)
      ... 17 more
      Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.phoenix.util.DateUtil$ISODateFormatParser
      at org.apache.phoenix.util.DateUtil$ISODateFormatParserFactory.getParser(DateUtil.java:242)
      at org.apache.phoenix.util.DateUtil.getDateTimeParser(DateUtil.java:132)
      at org.apache.phoenix.expression.function.ToDateFunction.init(ToDateFunction.java:69)
      at org.apache.phoenix.expression.function.ToDateFunction.readFields(ToDateFunction.java:155)
      at org.apache.phoenix.expression.BaseCompoundExpression.readFields(BaseCompoundExpression.java:110)
      at org.apache.phoenix.expression.ComparisonExpression.readFields(ComparisonExpression.java:341)
      at org.apache.phoenix.filter.BooleanExpressionFilter.readFields(BooleanExpressionFilter.java:106)
      ... 21 more

      at sqlline.IncrementalRows.hasNext(IncrementalRows.java:73)
      at sqlline.TableOutputFormat.print(TableOutputFormat.java:33)
      at sqlline.SqlLine.print(SqlLine.java:1653)
      at sqlline.Commands.execute(Commands.java:833)
      at sqlline.Commands.sql(Commands.java:732)
      at sqlline.SqlLine.dispatch(SqlLine.java:808)
      at sqlline.SqlLine.begin(SqlLine.java:681)
      at sqlline.SqlLine.start(SqlLine.java:398)
      at sqlline.SqlLine.main(SqlLine.java:292)

      I tested below cases and that succeeded

      • TO_DATE used in SELECT-caluse
      • TO_DATE used at RHS in WHERE-caluse. (In this case, BIRTH field was DATE type)

      Does anybody have a solution? or is it a bug?

      Attachments

        1. PHOENIX-1769.patch
          2 kB
          Thomas D'Silva
        2. PHOENIX-1769.patch
          3 kB
          Soumen Bandyopadhyay
        3. PHOENIX-v2.patch
          8 kB
          Thomas D'Silva

        Issue Links

          Activity

            People

              tdsilva Thomas D'Silva
              yunsh Sanghyun Yun
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: