I am parsing a date by the following statements and the spark program is throwing error while execution.
import java.time.LocalDate
val filterDate = "2017-06-26"
val filter = LocalDate.parse(load_dt)
I used filter variable in filtering records from a data frame column.
val df1 = spark.sql("select * from tableA")
val df2 = df1.filter(load_dt = filter)
while executing the above program it threw following error
User class threw exception: org.apache.spark.sql.AnalysisException: cannot resolve '(tableA.`load_dt` = ((2017 - 6) - 26))' due to data type mismatch: differing types in '(tableA.`load_dt` = ((2017 - 6) - 26))' (date and int).; line 1 pos 0;
I couldn't understand why it is looking at (2017 - 6) separately and (-26) separately.
could anyone please help Thanks