Yao Zhang created HUDI-7311:
-------------------------------

             Summary: Comparing date with date literal in string format causes 
class cast exception during filter push down
                 Key: HUDI-7311
                 URL: https://issues.apache.org/jira/browse/HUDI-7311
             Project: Apache Hudi
          Issue Type: Bug
          Components: flink
    Affects Versions: 0.14.1, 0.14.0
            Reporter: Yao Zhang
            Assignee: Yao Zhang


Given any table with arbitrary field typed date (e.g. field d_date with type of 
date). And execute the SQL with conditions for this field in where clause.
{code:sql}
select d_date from xxx where d_date = '2020-01-01'
{code}
An exception will occur:
{code:java}
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to 
java.lang.Integer
        at 
org.apache.hudi.source.ExpressionPredicates.toParquetPredicate(ExpressionPredicates.java:613)
        at 
org.apache.hudi.source.ExpressionPredicates.access$100(ExpressionPredicates.java:64)
        at 
org.apache.hudi.source.ExpressionPredicates$ColumnPredicate.filter(ExpressionPredicates.java:226)
        at 
org.apache.hudi.table.format.RecordIterators.getParquetRecordIterator(RecordIterators.java:68)
        at 
org.apache.hudi.table.format.cow.CopyOnWriteInputFormat.open(CopyOnWriteInputFormat.java:130)
        at 
org.apache.hudi.table.format.cow.CopyOnWriteInputFormat.open(CopyOnWriteInputFormat.java:66)
        at 
org.apache.flink.streaming.api.functions.source.InputFormatSourceFunction.run(InputFormatSourceFunction.java:84)
        at 
org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:110)
        at 
org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:67)
        at 
org.apache.flink.streaming.runtime.tasks.SourceStreamTask$LegacySourceFunctionThread.run(SourceStreamTask.java:333)
{code}
Hudi Flink cannot convert the date literal in String format to Integer (the 
primitive type of date). However this SQL in Flink without Hudi works well.

In summary, we should add literal type auto conversion before filter push down.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to