You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/10/27 13:18:21 UTC

[GitHub] [arrow-datafusion] alamb opened a new issue, #3982: Implement `current_time` Function

alamb opened a new issue, #3982:
URL: https://github.com/apache/arrow-datafusion/issues/3982

   **Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
   As we add more full featured date/time support for DataFusion users need to be able to use the current time to calculate things like "all data in the last 5 hours" 
   
   **Describe the solution you'd like**
   Support the `current_time` postgres function https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT
   
   Note I think we should avoid the `current_time(precision)` variant initially -- we can implement it as a follow on PR.
   
   **Describe alternatives you've considered**
   A clear and concise description of any alternative solutions or features you've considered.
   
   **Additional context**
   This is a feature request we got from an early (internal) user of InfluxDB IOx
   
   I believe this is a good first issue as you can follow the existing implementation of  `now()` 
   - [ ] Physical support: https://github.com/apache/arrow-datafusion/blob/f1322592046a7ea895820286a2ad16d934540d92/datafusion/physical-expr/src/functions.rs#L424-L429) and use the same `query_execution_start_time` field
   - [ ] Tests: https://github.com/apache/arrow-datafusion/blob/beeb631d0bb979e9b6826f6cd3eae2d0a24f471e/datafusion/core/tests/sql/timestamp.rs#L417
   
   It would be a good exercise to add a new build in scalar function, physical planing support, and then tests
   
   Note this the same ticket exists for the `current_date` function https://github.com/apache/arrow-datafusion/issues/3981
   


-- 
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: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] comphead commented on issue #3982: Implement `current_time` Function

Posted by GitBox <gi...@apache.org>.
comphead commented on issue #3982:
URL: https://github.com/apache/arrow-datafusion/issues/3982#issuecomment-1295974145

   > This sounds good start to me, could you please assign it to me or some extra advises?
   
   Hi @naosense please follow the #4022 PR
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb closed issue #3982: Implement `current_time` Function

Posted by GitBox <gi...@apache.org>.
alamb closed issue #3982: Implement `current_time` Function
URL: https://github.com/apache/arrow-datafusion/issues/3982


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] waitingkuo commented on issue #3982: Implement `current_time` Function

Posted by GitBox <gi...@apache.org>.
waitingkuo commented on issue #3982:
URL: https://github.com/apache/arrow-datafusion/issues/3982#issuecomment-1296179550

   @alamb i have no idea for timetz in arrow-rs for now as `Time` has not timezone (e.g. `DataType::Time64(TimeUnit::Nanosecond)` while `Timestamp` has (e.g. `DataType::Timestamp(TimeUnit::Nanosecond, Some("UTC".to_string()))`
   
   i think we could either 
   1. follow postgresql's function signature that means we could implement `LOCAL_TIME` instead
   2. keep it simple, return `TIME` directly for now and comment it
   
   in the long run, we might consider make these function names explicitly like what was discussed in 
   https://github.com/apache/arrow-datafusion/issues/686#issuecomment-885171173


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] naosense commented on issue #3982: Implement `current_time` Function

Posted by GitBox <gi...@apache.org>.
naosense commented on issue #3982:
URL: https://github.com/apache/arrow-datafusion/issues/3982#issuecomment-1295696979

   This sounds good start to me, could you please assign it to me or some extra advises?


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] naosense commented on issue #3982: Implement `current_time` Function

Posted by GitBox <gi...@apache.org>.
naosense commented on issue #3982:
URL: https://github.com/apache/arrow-datafusion/issues/3982#issuecomment-1296433512

   > > This sounds good start to me, could you please assign it to me or some extra advises?
   > 
   > Hi @naosense please follow the #4022 PR
   > 
   
   That's nice, thanks!


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on issue #3982: Implement `current_time` Function

Posted by GitBox <gi...@apache.org>.
alamb commented on issue #3982:
URL: https://github.com/apache/arrow-datafusion/issues/3982#issuecomment-1295808813

   @waitingkuo  I was imagining it would return a https://docs.rs/arrow/latest/arrow/array/type.Time64NanosecondArray.html 
   
   But I have not thought as deeply as you about the timezone implications, so if you have a different suggestion I would love to hear it. 
   
   >  This sounds good start to me, could you please assign it to me or some extra advises?
   
   Hi @naosense  -- thanks and done!
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on issue #3982: Implement `current_time` Function

Posted by GitBox <gi...@apache.org>.
alamb commented on issue #3982:
URL: https://github.com/apache/arrow-datafusion/issues/3982#issuecomment-1297613771

   > keep it simple, return TIME directly for now and comment it
   
   This would be my suggestion


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] waitingkuo commented on issue #3982: Implement `current_time` Function

Posted by GitBox <gi...@apache.org>.
waitingkuo commented on issue #3982:
URL: https://github.com/apache/arrow-datafusion/issues/3982#issuecomment-1295789738

   @alamb postgresql's current_time returns TIMETZ
   
   ```bash
   willy=# select pg_typeof(current_time);
         pg_typeof      
   ---------------------
    time with time zone
   (1 row)
   ```
   
   what should we return here?


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org