What are TOP_COUNT and TOP_MAXCOUNT in BigQuery?

I have this request that I use because naive GROUP BYgives an exceeded resource. Documents say what TOPshould be used for this case.

SELECT TOP(col), COUNT(distinct(othercol)) FROM [table]

When I run this, I get an error message saying that I can only use COUNT(*)as it says in the docs.

Error: Only COUNT(*) and MAXCOUNT(*) are allowed with TOP(). Use TOP_COUNT or TOP_MAXCOUNT instead., TOP() must be accompanied by COUNT(*). Try TOP_COUNT or TOP_MAXCOUNT instead.

The question is, what TOP_COUNTand TOP_MAXCOUNT? They are not documented anywhere.

+4
source share
1 answer

First, if you change the GROUP BY query to use GROUP EACH BY (described here ), your original query will most likely work.

TOP_COUNT TOP_MAXCOUNT , BigQuery. , ( ).

+4

Source: https://habr.com/ru/post/1531366/


All Articles