You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "xudong963 (via GitHub)" <gi...@apache.org> on 2025/02/13 04:21:02 UTC

[I] Feature: support cast `date` to `timestamp` with tz [datafusion]

xudong963 opened a new issue, #14638:
URL: https://github.com/apache/datafusion/issues/14638

   ### Is your feature request related to a problem or challenge?
   
   ```
   > select to_char(arrow_cast('2023-09-04'::date, 'Timestamp(Second, Some("UTC"))'), '%Y-%m-%dT%H:%M:%S%.3f');
   This feature is not implemented: Unsupported CAST from Date32 to Timestamp(Second, Some("UTC"))
   ```
   
   ### Describe the solution you'd like
   
   _No response_
   
   ### Describe alternatives you've considered
   
   Maybe it should be implemented in arrow-rs?
   
   ### Additional context
   
   _No response_


-- 
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@datafusion.apache.org.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Feature: support cast `date` to `timestamp` with tz [datafusion]

Posted by "Omega359 (via GitHub)" <gi...@apache.org>.
Omega359 commented on issue #14638:
URL: https://github.com/apache/datafusion/issues/14638#issuecomment-2755651138

   I believe the arrow update is in the [arrow 54.3.0 release](https://github.com/apache/arrow-rs/releases/tag/54.3.0) so once DF is upgraded to that release we can verify it in DF.


-- 
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@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Feature: support cast `date` to `timestamp` with tz [datafusion]

Posted by "friendlymatthew (via GitHub)" <gi...@apache.org>.
friendlymatthew commented on issue #14638:
URL: https://github.com/apache/datafusion/issues/14638#issuecomment-2682479002

   The next release of arrow should support this _mini_ feature! @Omega359, is there a timeline for upgrading the arrow dependency in datafusion?


-- 
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@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Feature: support cast `date` to `timestamp` with tz [datafusion]

Posted by "friendlymatthew (via GitHub)" <gi...@apache.org>.
friendlymatthew commented on issue #14638:
URL: https://github.com/apache/datafusion/issues/14638#issuecomment-2661545885

   Datafusion-wise, I tested this feature in [this branch](https://github.com/apache/datafusion/compare/main...friendlymatthew:datafusion:friendlymatthew/cast-date-to-timestamp-tz-patch) and it works as expected:
   
   ```bash
   > select to_char(arrow_cast('2023-09-04'::date, 'Timestamp(Second, Some("UTC"))'), '%Y-%m-%dT%H:%M:%S%.3f');
   +--------------------------------------------------------------------------------------------------------------+
   | to_char(arrow_cast(Utf8("2023-09-04"),Utf8("Timestamp(Second, Some("UTC"))")),Utf8("%Y-%m-%dT%H:%M:%S%.3f")) |
   +--------------------------------------------------------------------------------------------------------------+
   | 2023-09-04T00:00:00.000                                                                                      |
   +--------------------------------------------------------------------------------------------------------------+
   1 row(s) fetched.
   Elapsed 0.027 seconds.
   ```
   
   Once https://github.com/apache/arrow-rs/pull/7141 lands, I'll follow up with some test cases in `cast.slt`.


-- 
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@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Feature: support cast `date` to `timestamp` with tz [datafusion]

Posted by "friendlymatthew (via GitHub)" <gi...@apache.org>.
friendlymatthew commented on issue #14638:
URL: https://github.com/apache/datafusion/issues/14638#issuecomment-2661249660

   > It seems that `Date32`/`Date64` doesn't support TZ, so if we want to support the cast, we should add TZ to `Date32/Date64` firstly?
   
   I'm not sure if `Date` types should be time-zone aware. Postgres has a similar `Date` time and [does not allow dates with associated time zones](https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-TIMEZONES:~:text=Although%20the%20date%20type%20cannot%20have%20an%20associated%20time%20zone%2C%20the%20time%20type%20can.). 
   
   However when casting a `Date` into a `Timestamp`, we should definitely support various time zones! I've posted a PR [for that](https://github.com/apache/arrow-rs/pull/7141).
   
   


-- 
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@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Feature: support cast `date` to `timestamp` with tz [datafusion]

Posted by "xudong963 (via GitHub)" <gi...@apache.org>.
xudong963 commented on issue #14638:
URL: https://github.com/apache/datafusion/issues/14638#issuecomment-2658438819

   It seems that `Date32`/`Date64` doesn't support TZ, so if we want to support the cast, we should add TZ to `Date32/Date64` firstly?


-- 
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@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Feature: support cast `date` to `timestamp` with tz [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #14638: Feature: support cast `date` to `timestamp` with tz
URL: https://github.com/apache/datafusion/issues/14638


-- 
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@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Feature: support cast `date` to `timestamp` with tz [datafusion]

Posted by "friendlymatthew (via GitHub)" <gi...@apache.org>.
friendlymatthew commented on issue #14638:
URL: https://github.com/apache/datafusion/issues/14638#issuecomment-2756504786

   > I believe the arrow update is in the [arrow 54.3.0 release](https://github.com/apache/arrow-rs/releases/tag/54.3.0) so once DF is upgraded to that release we can verify it in DF.
   
   Thank you @Omega359. I'll make sure to follow up with some SLT test cases. 


-- 
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@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Feature: support cast `date` to `timestamp` with tz [datafusion]

Posted by "friendlymatthew (via GitHub)" <gi...@apache.org>.
friendlymatthew commented on issue #14638:
URL: https://github.com/apache/datafusion/issues/14638#issuecomment-2661135828

   take


-- 
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@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Feature: support cast `date` to `timestamp` with tz [datafusion]

Posted by "Omega359 (via GitHub)" <gi...@apache.org>.
Omega359 commented on issue #14638:
URL: https://github.com/apache/datafusion/issues/14638#issuecomment-2682568288

   arrow-rs releases are not in sync with df releases so it will likely be df 57 or 48


-- 
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@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org