I created a table which has one field of type Date, namely f_date. One part of my desired query filter table rows based on the f_date field. So I did the followings:
mytable.filter("f_date <= '1998-10-02'")
and
mytable.filter("f_date <= '1998/10/02'")
then I got the following same error in all two cases:
Expression 'f_date <= 1998/10/02 failed on input check: Comparison is only supported for numeric types and comparable types of the same type, got Date and String
I even remove the single quatation and tried:
mytable.filter("f_date <= 1998/10/02")
and I got the error:
Expression 'f_date <= ((1998 / 10) / 2) failed on input check: Comparison is only supported for numeric types and comparable types of same type, got Date and Integer
At the end I create a Date object and try:
mytable.filter("f_date <=" + Java.sql.Date.valueOf("1998-10-22"))
and I got the error:
Expression 'f_date <= ((1998 - 10) - 2) failed on input check: Comparison is only supported for numeric types and comparable types of the same type, got Date and Integer
In the above cases, Flink recognized the date as String or Integer. How can I give the date in proper format!?
I should convert String to Date using the toDate
method.
filter("f_date <= '1998-10-02'.toDate")