Closed Shanmugavel-J closed 1 month ago
Databend currently supports adding and subtracting various time units such as years, months, days, hours, minutes, and seconds, but it appears that the week
unit is not yet supported for the DATE_ADD
function [1][2].
To add support for the week
unit, you would need to follow these steps:
Implement the Function:
week
unit in the relevant function, such as date_add
or add_weeks
.Register the Function:
register_add_functions
method in src/query/functions/src/scalars/datetime.rs
.Add Tests:
src/query/functions/tests/it/scalars/datetime.rs
.Update Documentation:
For detailed guidance on writing and registering new functions, you can refer to the following guides:
This process will ensure that the week
unit is supported in date operations like DATE_ADD
.
To continue talking to Dosu, mention @dosu.
Maybe you can try:
root@localhost:8000/default> SELECT DATE_ADD('day', 7, TODAY());
SELECT
DATE_ADD('day', 7, TODAY())
-[ RECORD 1 ]-----------------------------------
DATE_ADD(DAY, 7, today()): 2024-09-12
And I think it's a good first issue.
Yes @TCeason This would be a good addition for DATE functionality to ADD ON. Thanks!
It is good to have week as an unit. multiplication of 7 would be required.
Please assign me 😊
Summary
Not able to perform Date operations with unit week. Can it be added as a additional support for
week
.QUERY:
SELECT DATE_ADD('week', 1, TODAY());