What is POSITION(field) in Google BIgQuery?



我使用Google BigQuery,并对它提供的POSITION(field)函数有疑问。

我认为 POSITION 函数在嵌套字段中返回查询中值的位置。

但我很惊讶它也适用于非嵌套字段。

例如。

SELECT url, POSITION(url) FROM [publicdata:samples.github_timeline] WHERE url="https://github.com/oscardelben/sheet";

输出为

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
....
...
..
.

在这种情况下,POSITION(url)是什么意思?还有谷歌 BigQuery 示例提供的任何嵌套字段可供我测试吗?

我很感激哟

我所知,对于非嵌套字段,POSITION 将返回数据分片中的行偏移量——也就是说,如果将底层数据拆分为 100 个部分,并且您的结果每个部分有 10 行,您将有 1-10 的位置值重复 100 次。这不太可能特别有用。可以说,这应该返回全局位置(也就是说,在上述情况下它将返回 1-1000),如果您同意,请告诉我,我会看看是否可以更改。

最新更新