-- Top applications by number of flows

SELECT
    splitByChar('.', "nDPIclass")[1] AS appl,
    COUNT(*) AS cnt
FROM
    flow
WHERE
    "timeFirst" >= {time_from:DateTime64(6)}
    AND "timeLast" <= {time_to:DateTime64(6)}

GROUP BY appl
ORDER BY cnt DESC

LIMIT {n:UInt64}
