Hi. I’m new to Flink and need help on modeling our...
# troubleshooting
j
Hi. I’m new to Flink and need help on modeling our data aggregation in Flink API. I’m not sure if this is correct place to ask questions. let me know if there is a better place. I’m trying to maintain the win rate of the gamers of the last 100 games (by event timestamp) . the source event looks like this
Copy code
class GameEvent {
  string userID
  int eventType // started, lost, won etc.
  string gameID
  string eventID
  long timestamp
}
More generally, We want to maintain each user’s win count of the last 100 games they played. So for the last 100 “started” games, we need to keep “won” event for the matching gameID. It is clear to me that the
userID
will be the key, and
timestamp
will be the event time field. But I’m not sure how to model this type of window, and aggregation functions to keep last 100 games and matching “won” events. Also there can be duplicated events so it should be deduplicated by
eventID
or a combination of
gameID, eventType
. It seems I need to use some sort of custom window functions, but i’m not sure what’s provided out of the box, and what i need to implement by myself. I appreciate any help.