You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Appears in 3.14
The following expression in Trino (MOD((DAY_OF_YEAR(world."orders.date") % 7) - 1 + 7, 7))
is transpiled in Snowflake as ((DAYOFYEAR(orders.date) % 7) - 1 + 7 % 7)
The transpiled expression returns incorrect result, as values could be negative (-1). Missing a parenthesis before the modulo operator, to make it correct.
Appears in 3.14
The following expression in Trino
(MOD((DAY_OF_YEAR(world."orders.date") % 7) - 1 + 7, 7))
is transpiled in Snowflake as
((DAYOFYEAR(orders.date) % 7) - 1 + 7 % 7)
The transpiled expression returns incorrect result, as values could be negative (-1). Missing a parenthesis before the modulo operator, to make it correct.
Expected result:
(MOD((DAYOFYEAR(orders.date) % 7) - 1 + 7, 7))
or
(((DAYOFYEAR(orders.date) % 7) - 1 + 7 ) % 7)
Fully reproducible code snippet
Official Documentation
https://trino.io/docs/current/functions/datetime.html#day_of_year
https://trino.io/docs/current/functions/math.html#mod
https://docs.snowflake.com/en/sql-reference/functions/year
https://docs.snowflake.com/en/sql-reference/functions/mod
The text was updated successfully, but these errors were encountered: