This SQL-MapReduce call gets the pageid for each row and the pageid for the next row in sequence:
SELECT sessionid, pageid, next_pageid FROM nPath ( ON clicks1 PARTITION BY sessionid ORDER BY ts MODE (OVERLAPPING) PATTERN ('A.B') SYMBOLS (true AS A, true AS B) RESULT (FIRST(sessionid OF A) AS sessionid, FIRST (pageid OF A) AS pageid, FIRST (pageid OF B) AS next_pageid ) );