LINQ-to-BigQuery
LINQ-to-BigQuery copied to clipboard
Groupby Count
How do I get this using the library? Which is use the count in the select and order by the count
SELECT actor_login, count(*) as Count FROM [github.dotnet]
WHERE type = "PullRequestEvent"
group by actor_login
order by Count desc
limit 100
I tried this but the
var pr = "PullRequestEvent";
var basequery = From<dotnet>().Where(d => d.type == pr)
.Select(e => new { e.actor_login, e.repo_name })
.GroupBy(e => new { e.actor_login, e.repo_name})
.Limit(100)
.RunDry()
.Dump();
The query it output from the linq is
SELECT
[actor_login],
[repo_name]
FROM
[github-data-1163:github.dotnet]
WHERE
([type] = 'PullRequestEvent')
GROUP BY
[actor_login],
[repo_name]
LIMIT 100
All BigQuery's function under BqFunc.
You can write
.Select(e => new { count = BqFunc.Count(), e.actor_login, e.repo_name })
or
.Select(e => new { count = Count(), e.actor_login, e.repo_name })
Thanks for the support. Could I do a PR for the README with all the things I learn trying to use this?