how does SQL mode work with PopularPlaces example?

Posted by James Yu on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/how-does-SQL-mode-work-with-PopularPlaces-example-tp19113.html

Hi,

I am following the PopularPlacesSQL example (http://training.data-artisans.com/exercises/popularPlacesSql.html), but I am unable to understand why the following statement will pickup events with START flag only.

"SELECT " +
"toCoords(cell), wstart, wend, isStart, popCnt " +
"FROM " +
"(SELECT " +
"cell, " +
"isStart, " +
"HOP_START(eventTime, INTERVAL '5' MINUTE, INTERVAL '15' MINUTE) AS wstart, " +
"HOP_END(eventTime, INTERVAL '5' MINUTE, INTERVAL '15' MINUTE) AS wend, " +
"COUNT(isStart) AS popCnt " +
"FROM " +
"(SELECT " +
"eventTime, " +
"isStart, " +
"CASE WHEN isStart THEN toCellId(startLon, startLat) ELSE toCellId(endLon, endLat) END AS cell " +
"FROM TaxiRides " +
"WHERE isInNYC(startLon, startLat) AND isInNYC(endLon, endLat)) " +
"GROUP BY cell, isStart, HOP(eventTime, INTERVAL '5' MINUTE, INTERVAL '15' MINUTE)) " +
"WHERE popCnt > 20"

Since we can update state in processElement when we do it with low level ProcessFunction, how does SQL rule out the un-paired events?


This is a UTF-8 formatted mail
-----------------------------------------------
James C.-C.Yu
+886988713275