组合引导函数,第二窗口函数和列别名时出现神秘错误

时间:2015-10-01 12:45:35

标签: google-bigquery window-functions column-alias

考虑以下问题:

select
   corpus_date as alias
   ,lead(word, 1) over (partition by corpus order by word_count desc) lead
   ,max(word_count) over (partition by corpus) max_word_count

from
   [publicdata:samples.shakespeare]

where corpus='othello' and length(word) > 10

limit 5

这会向我显示错误消息Field 'alias' not found.alias仅用作此查询中的别名。另请注意,如果我注释掉别名,lead函数或min函数,则错误消失。如果我将lead替换为minsum等其他窗口函数,则错误也会消失,而如果我同样替换max,则错误仍然存​​在,因此必要的成分似乎是

  • lead功能
  • 另一个窗口函数
  • 别名字段

我想知道这些函数如何在内部工作导致这个神秘的错误。

0 个答案:

没有答案