Google Big Query を使用して GitHub アーカイブからデータを取得しようとしています。リクエストしている現在のデータ量は BigQuery が処理するには(少なくとも無料枠では)多すぎるため、リクエストの範囲を制限しようとしています。
現在1000 を超えるスターを持つリポジトリのみが過去のデータを返すように、データを制限したいと考えています。リポジトリが取得した最初の 1000 個のスターの履歴データが除外されるため、単に repository_watchers > 1000 と言うよりも複雑です。
SELECT repository_name, repository_owner, created_at, type, repository_url, repository_watchers
FROM [githubarchive:github.timeline]
WHERE type="WatchEvent"
ORDER BY created_at DESC
編集:私が使用したソリューション(@Brianの回答に基づく)
select y.repository_name, y.repository_owner, y.created_at, y.type, y.repository_url, y.repository_watchers
from [githubarchive:github.timeline] y
join (select repository_url, max(repository_watchers)
from [githubarchive:github.timeline] x
where x.type = 'WatchEvent'
group by repository_url
having max(repository_watchers) > 1000) x
on y.repository_url = x.repository_url
where y.type = 'WatchEvent'
order by y.repository_name, y.repository_owner, y.created_at desc