GBQ window 函数 AND 算术运算

GBQ window function AND arithmetic operations

有谁知道是否可以对使用 GBQ window 函数导出的结果进行任何算术运算?

例如,我可以使用如下伪代码将 row_number 增加 100(某个数字)吗:

SELECT 100 + ROW_NUMBER() OVER (PARTITION BY X ORDER BY x_id DESC) increased_row_num
FROM Table1
...

你需要为此使用子查询

SELECT 100 + row_num AS increased_row_num FROM (
SELECT ROW_NUMBER() OVER (PARTITION BY X ORDER BY x_id DESC) AS row_num
FROM Table1
)

but I'we hoped that there is another solution

使用 BigQuery Standard SQL 预期功能现在可以正常工作

#standardSQL
SELECT 100 + ROW_NUMBER() OVER (PARTITION BY X ORDER BY x_id DESC) increased_row_num
FROM Table1

Enabling Standard SQL and Migrating from legacy SQL