I am trying to learn Spark. I have a org.apache.spark.sql.Column
which I am reading in as a DataFrame
. And then I am trying to filter it using a condition on a column:
val resultDataFrame = dataFrame.filter(col("DATECOL") >= date)
The DATECOL
is being read as DataTypes.DateType
in to the DataFrame. date
is a variable that I have to hardcode.
What I am trying to figure out is how can I define date
i.e. how can I create an instance of DataTypes.DateType
or convert to it from a String
or so, so that I can run the above expression. I tried using a String
and it does not give an error, but it returns with no results where it should.