]
Ted Jones reassigned TEIID-4224:
--------------------------------
Assignee: Ted Jones (was: Steven Hawkins)
HANA translator : incorrect pushdown of DAYOFWEEK function
----------------------------------------------------------
Key: TEIID-4224
URL:
https://issues.jboss.org/browse/TEIID-4224
Project: Teiid
Issue Type: Bug
Components: Misc. Connectors
Affects Versions: 8.12.5
Reporter: Jan Stastny
Assignee: Ted Jones
Teiid's DAYOFWEEK function:
{code:plain}
DAYOFWEEK(x) Return day of week (Sunday=1, Saturday=7)
{code}
is pushed down as:
{code:plain}
dayname(g_0."DATEVALUE")
{code}
but this function returns string representation of the day.
More appropriate would be to push DAYOFWEEK as WEEKDAY function, but the returned value
has to be adapted to Teiid's representation (Sunday=1 and Saturday=7, vs. HANA's
Monday=0,Sunday=6). So the solution would be to push:
{code:sql}
MOD((WEEKDAY(datevalue)+1),7)+1
{code}