You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "sgrebnov (via GitHub)" <gi...@apache.org> on 2026/04/01 09:34:11 UTC

[I] unparser: use `to_rfc3339` for `TIMESTAMPTZ` formatting [datafusion]

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

   As discussed [here](https://github.com/apache/datafusion/pull/21103#issuecomment-4137545691) the unparser default behavior is to use `DateTime<Tz>.to_string()` to unparse  timestamp with time zone values, which produce literals not supported by multiple dialects (eg `DuckDB`, `BigQuery`).
   
   We should switch to `DateTime<Tz>.to_rfc3339`  as the default formatting, which produces a valid ISO 8601 / RFC 3339 timestamp string and is more broadly compatible across dialects.
   
   ```
   /// Returns an RFC 3339 and ISO 8601 date and time string such as `1996-12-19T16:39:57-08:00`.
       #[cfg(feature = "alloc")]
       #[must_use]
       pub fn to_rfc3339(&self) -> String {
           // For some reason a string with a capacity less than 32 is ca 20% slower when benchmarking.
           let mut result = String::with_capacity(32);
           let naive = self.overflowing_naive_local();
           let offset = self.offset.fix();
           write_rfc3339(&mut result, naive, offset, SecondsFormat::AutoSi, false)
               .expect("writing rfc3339 datetime to string should never fail");
           result
       }
   ```


-- 
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] unparser: use `to_rfc3339` for `TIMESTAMPTZ` formatting [datafusion]

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

   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] unparser: use `to_rfc3339` for `TIMESTAMPTZ` formatting [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #21294: unparser: use `to_rfc3339` for `TIMESTAMPTZ` formatting
URL: https://github.com/apache/datafusion/issues/21294


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