I am trying to get a filtered list of list of auctions around the time of specific winning auctions while using spark.
The winning auction RDD, and the full auctions DD is made up of case classes with the format:
case class auction(id: String, prodID: String, timestamp: Long)
I would like to filter the full auctions RDD where auctions occurred within 10 seconds of the winning auction, on the same product ID, and receive an RDD full of these.
I have attempted to filter it like this:
val specificmessages = winningauction.map(it =>
allauctions.filter( x =>
x.timestamp > it.timestamp - 10 &&
x.timestamp < it.timestamp + 10 &&
x.productID == it.productID
)
)
Is there a way to perform this as nested transformations are not possible?
there is another answer but this mainly deals with nested maps SPARK-5603 nested map funcitons