Re: how does SQL mode work with PopularPlaces example?
Posted by
Fabian Hueske-2 on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/how-does-SQL-mode-work-with-PopularPlaces-example-tp19113p19126.html
Hi James,
the exercise does not require to filter on pickup events. It says:
"This is done by counting every five minutes the number of taxi rides
that started and ended in the same area within the last 15 minutes.
Arrival and departure locations should be separately counted."
That is achieved by including isStart in the GROUP BY fields.
If you would only like to count pickup locations, you can just add a predicate "WHERE isStart".
Regarding the question of state cleanup, the query does not require to join start and end events. Both are separately counted.
To join start and end events, you can use a time-windowed join [1] (since Flink 1.4) which will automatically remove rows from the state that fell out of the join window.
Best, Fabian
[1]
https://ci.apache.org/projects/flink/flink-docs-release-1.4/dev/table/sql.html#joins