Files
doris/regression-test/suites/variant_p2/sql/distributionOfRepositoriesByStarCount.sql

15 lines
296 B
SQL

SELECT
cast(pow(10, floor(log10(c))) as int) AS stars,
count(distinct k)
FROM
(
SELECT
cast(repo["name"] as string) as k,
count() AS c
FROM github_events
WHERE type = 'WatchEvent'
GROUP BY cast(repo["name"] as string)
) t
GROUP BY stars
ORDER BY stars ASC