cgivre commented on issue #2390:
URL: https://github.com/apache/drill/issues/2390#issuecomment-982612288


   @pandalanax 
   Thanks for your interest in Drill!  You might want to take a look at the 
`nearestdate()` function. [1]
   This has similar functionality to what you're describing although I do agree 
it would be good to add the `WEEK` to the `EXTRACT` function.
   
   For example, you could do the following query:
   
   ```sql
   SELECT nearestdate(CURRENT_DATE, 'WEEK_SUNDAY') AS current_week 
   FROM ...
   ```
   If you wanted the week number you could wrap this in the `TO_DATE` function 
like this:
   
   ```sql
   SELECT TO_DATE(nearestDate(CURRENT_DATE, 'WEEK_SUNDAY'), 'w') AS week_num
   FROM ....
   ```
   
   
   [1]: 
https://drill.apache.org/docs/date-time-functions-and-arithmetic/#nearestdate


-- 
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]


Reply via email to