7 days since last event">
shlogg · Early preview
Judy @esproc_spl

Adding Session ID Column In Big Query With SPL Code

Added "session id" column in Big Query: set first event as checkpoint, increment ID if > 7 days since last event. SPL code provided.

The table in the Big Query database records multiple events of a user, such as a user sorted by time as follows:

Now we need to add a calculated column called 'session id': set the first event as a checkpoint, with session id set to 1; If the interval between the new event and the checkpoint is within 7 days, the session ID remains unchanged; If the interval between the new event and the checkpoint is greater than 7 days, the session ID will be incremented and the checkpoint will be reset to that event.

SPL code:

A1: Query the event records of a user through JDBC.
A2: Set variables, where d...