Pranay Das
04/05/2024, 6:05 AM{"timestamp": 1706928619000, "id": 1419, "user_id": "17ebbfd7-3e4f-4197-b504-82df1c5d06b6", "page category": 76, "url": "news.com"}
{"timestamp": 1707229698000, "id": 1412, "user_id": "124443f8-5a58-48b7-9874-779a649d7fae", "page category": 89, "url": "sports.com"}
{"timestamp": 1707229698000, "id": 1412, "user_id": "124443f8-5a58-48b7-9874-779a649d7fae", "page category": 89, "url": "sports.com"}
I want to filter out the duplicate user_id logs for a period of a month, the logs shouldn't be duplicate, and only unique user logs should sink to Kafka. The data is high volume logs.
I'm considering using DataSketches library for techniques like Bloom filtering or count min sketch. I also want to backup and restore the state of the Bloom filter.
Can this be achieved using Flink?Marco Villalobos
04/05/2024, 1:36 PMKeyedProcessFunction with the user_id as your key. Add a ValueState with a TTL of one month. It could be a simple boolean. If that value state is there, then do not collect the record (like a filter). If that value state is not there, collect the record and assign the value state.Pranay Das
04/05/2024, 4:41 PMMarco Villalobos
04/05/2024, 11:16 PM{"timestamp": 1707229698000, "id": 1412, "user_id": "124443f8-5a58-48b7-9874-779a649d7fae", "page category": 89, "url": "sports.com"}
{"timestamp": 1707229698000, "id": 1412, "user_id": "124443f8-5a58-48b7-9874-779a649d7fae", "page category": 90, "url": "movies.com"}
would only log the first entry.Marco Villalobos
04/05/2024, 11:16 PMPranay Das
04/07/2024, 9:33 AMPranay Das
04/07/2024, 9:33 AM