martinky opened a new issue, #14033: URL: https://github.com/apache/druid/issues/14033
The implementation of the SQL function `EXTRACT(ISOYEAR FROM ...)` wrongly returns the same value as `EXTRACT(YEAR FROM ...)`. ### Affected Version 25.0.0 ### Description Steps to reproduce the problem: In Druid Console, enter the following SQL query and execute: ``` select EXTRACT(ISOYEAR FROM TIMESTAMP '2023-01-01') ``` Result: **2023** Expected result: **2022** Explanation: The week of the date **2023-01-01** is **52** and therefore the week of this date belongs to year **2022**, which should be returned by `EXTRACT(ISOYEAR ...)`. Any debugging that you have already done: I suspect the bug may be on this line - https://github.com/apache/druid/blob/master/processing/src/main/java/org/apache/druid/query/expression/TimestampExtractExprMacro.java#L141 In the linked source, the `ISOYEAR` case returns the same value as the `YEAR` case just above it. I believe this is an error and the `ISOYEAR` case should return the following value: ``` case ISOYEAR: return ExprEval.of(dateTime.weekyear().get()); ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
