'First_value function with IGNORE NULLS expression is not working on Athena AWS
I used fist value function, it works fine but when I added "IGNORE NULLS" I got the following error
line 1:179: mismatched input ')'. Expecting: 'OVER'
My function
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 )
So I looked at the documentation and the syntax looks fine.
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
So why I get an error?
Solution 1:[1]
Athena uses Presto, not Redshift, so use ignore nulls after closing brace of first_value:
first_value(if(DiffconvCompView = 0,null,DiffconvCompView)) ignore nulls OVER (...)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
