Compare 2 rows in a RDD


#1

Is there a way to compare 2 consecutive rows in RDD? is there a next function we can use? Also this needs to be one without using raw SQL

This is the problem I am dealing with

Input Schema:
id: string, timestamp: string, type: string, visitorId: string, pageUrl: string
Expected Output Schema:
id: string, timestamp: string, type: string, visitorId: string, pageUrl: string, nextPageUrl: String

given two sequential in time events e 1 and e 2 from a visitor v 1 , the output event o 1 should contain the id, timestamp, type, visitorId, & pageUrl from e 1 but the nextPageUrl will be the pageUrl from e 2 .