Im using Google BigQuery and have a questions of the POSITION(field) function that it provides.
I thought the POSITION function returns a position of the value in query within the nested field.
But i’m quite surprised that it also works on non-nested fields.
eg.
SELECT url, POSITION(url) FROM [publicdata:samples.github_timeline] WHERE url="https://github.com/oscardelben/sheet";
and the output is
Row url f0_
1 https://github.com/oscardelben/sheet 1
2 https://github.com/oscardelben/sheet 2
3 https://github.com/oscardelben/sheet 3
4 https://github.com/oscardelben/sheet 4
5 https://github.com/oscardelben/sheet 5
6 https://github.com/oscardelben/sheet 6
7 https://github.com/oscardelben/sheet 1
8 https://github.com/oscardelben/sheet 2
9 https://github.com/oscardelben/sheet 3
....
...
..
.
in this context, what does POSITION(url) mean?
also are there any nested field provided by the Google BigQuery samples that I can test with?
I appreciate yo
From what I can tell, for a non-nested field, POSITION will return the row offset in the data shard — that is, if the underlying data is split into 100 pieces, and your result has 10 rows per each piece, you would have position values of 1-10 repeated 100 times. This is unlikely to be particularly useful. Arguably, this should return the global position (that is, it would return 1-1000 in the above case), and if you agree, let me know and I’ll see if it can be changed.