Hi Friends
i am trying to pass a list of date ranges needs to be in the below format.
val predicates =
Array(
โ2021-05-16โ โ โ2021-05-17โ,
โ2021-05-18โ โ โ2021-05-19โ,
โ2021-05-20โ โ โ2021-05-21โ)
I am then using map to create a range of conditions that will be passed to the jdbc method.
val predicates =
Array(
โ2021-05-16โ โ โ2021-05-17โ,
โ2021-05-18โ โ โ2021-05-19โ,
โ2021-05-20โ โ โ2021-05-21โ)โฆmap { case (start, end) =>
s"cast(NEW_DT as date) >= date โ$startโ AND cast(NEW_DT as date) <= date โ$endโ"
The process will need to run daily and i need to dynamically populate these values as i cannot use the hard coded way.
Need help in how i can return these values from a method with incrementing start_date and end_date tuples that can generate like above.I had a mere idea like below but as i am new to scala not able to figure out. Please help
def predicateRange( start_date: String,
end_date: String): Array[(String,String)]= {
// iterate over the date values and add + 1 to both start and end and return the tuple
}