代码之家  ›  专栏  ›  技术社区  ›  idan

带有IGNORE NULLS表达式的First_value函数在Athena AWS上不起作用

  •  0
  • idan  · 技术社区  · 3 年前

    我使用了fist value函数,它可以正常工作,但当我添加“IGNORE NULLS”时,我得到了以下错误

    line 1:179: mismatched input ')'. Expecting: 'OVER'
    

    我的职能

    first_value (if(DiffconvCompView  = 0,null,DiffconvCompView)  ignore nulls) OVER (partition by Widget_id, User_country, Domain order by date desc , hour desc  ROWS BETWEEN UNBOUNDED PRECEDING AND 0 PRECEDING  )
    

    所以我查看了文档,语法看起来不错。

    FIRST_VALUE | LAST_VALUE
    ( expression [ IGNORE NULLS | RESPECT NULLS ] ) OVER
    (
    [ PARTITION BY expr_list ]
    [ ORDER BY order_list frame_clause ]
    )
    

    https://docs.aws.amazon.com/redshift/latest/dg/r_WF_first_value.html

    那我为什么会出错呢?

    0 回复  |  直到 3 年前
        1
  •  0
  •   Guru Stron    3 年前

    雅典娜使用 Presto ,而不是红移,所以使用 ignore nulls 在关闭 first_value :

    first_value(if(DiffconvCompView  = 0,null,DiffconvCompView)) ignore nulls OVER (...)