I'm first reading lower bound and upper bound using a:
select max(timestamp) ,min(timestamp) from table name
extracting
Row row=query.collectasList().get(0).getString(0) as lowerbound and upperbound
respectively
then passing lowerbound and upper bound
spark.read("jdbc")
.option("url", url)
.option("dbtable", "sample")
.option("user", user)
.option("driver","com.sqlserver")
.option("password", password)
.option("numPartitions", 100)
.option("partitionColumn", "timestamp")
.option("lowerBound", lowerbound)
.option("upperBound", upperbound )
lowerbound and upperbound format "2022-02-09 17:13:22.353"
I understand lowerbound and upper bound has to be string but when passed I'm facing the below issue can you please help? Facing this issue Lost task 6.0 in stage 1.0 (TID 7, , executor 1):
com.microsoft.sqlserver.jdbc.SQLServerException: Conversion failed when converting date and/or time from character string. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java