Lior
Lior

Reputation: 1467

BigQuery - running query with 2 different partitions

I'm trying to run a query with 2 different partitions. The difference is that one partition is sorted, the other isn't (query below just illustrates the problem, it has no meaning)

SELECT 
  repository.forks forks,
  repository.fork fork,
  row_number() over (partition by repository.url order by repository.created_at ) r,
  count (repository.fork) over (partition by repository.url) cnt,
FROM [publicdata:samples.github_nested] LIMIT 1000

When I run the query above I get a weird error: Field 'forks' not found; did you mean 'fork'?

When removing one of the window function, the query works fine.

Is it possible to run a query with 2 different partitions?

Upvotes: 3

Views: 423

Answers (1)

Khalid
Khalid

Reputation: 714

What about writing like:

SELECT 
  repository.forks ,
  repository.fork ,
  row_number() over (partition by repository.url order by repository.created_at ) r,
  count (repository.fork) over (partition by repository.url) cnt,
FROM [publicdata:samples.github_nested] LIMIT 1000

Upvotes: 2

Related Questions