You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "stevomitric (via GitHub)" <gi...@apache.org> on 2026/07/13 13:37:58 UTC
[PR] [WIP][SPARK-57816][SQL] Support nanosecond-precision timestamps in date_format, to_char and to_varchar [spark]
stevomitric opened a new pull request, #57225:
URL: https://github.com/apache/spark/pull/57225
### What changes were proposed in this pull request?
Extend `DateFormatClass` (which backs `date_format`, `to_char` and `to_varchar`) to accept nanosecond-precision timestamps (`TIMESTAMP_NTZ(p)`/`TIMESTAMP_LTZ(p)`, p in [7, 9]). Both eval and codegen render via the nanosecond-aware `TimestampFormatter`: NTZ renders its wall clock zone-independently, LTZ renders in the session zone, and sub-precision digits floor to zeros. Also guards `SimplifyDateTimeConversions` from rewriting a nanosecond child, whose round-trip through microsecond `TimestampType` would silently truncate.
### Why are the changes needed?
Nanosecond input was narrowed to microseconds, so the sub-microsecond digits never reached the formatter.
### Does this PR introduce _any_ user-facing change?
Yes. `date_format`/`to_char`/`to_varchar` now render nanosecond timestamps at full precision (preview `spark.sql.timestampNanosTypes.enabled`).
### How was this patch tested?
`DateExpressionsSuite`, `SimplifyDateTimeConversionsSuite`, `TimestampNanosFunctionsSuiteBase`, and `timestamp-{ltz,ntz}-nanos.sql` golden files.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-57816][SQL] Support nanosecond-precision timestamps in date_format, to_char and to_varchar [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on PR #57225:
URL: https://github.com/apache/spark/pull/57225#issuecomment-5001445522
**Merge Summary:**
- merged into master https://github.com/apache/spark/commit/c07d9be4706083d46658bbfe2a3dcfb26123af38
- merged into branch-4.x https://github.com/apache/spark/commit/c7a3eba7eb66622acbc4f1d7f6b3081f0f0f7f75
*Posted by `merge_spark_pr.py`*
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-57816][SQL] Support nanosecond-precision timestamps in date_format, to_char and to_varchar [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan closed pull request #57225: [SPARK-57816][SQL] Support nanosecond-precision timestamps in date_format, to_char and to_varchar
URL: https://github.com/apache/spark/pull/57225
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-57816][SQL] Support nanosecond-precision timestamps in date_format, to_char and to_varchar [spark]
Posted by "stevomitric (via GitHub)" <gi...@apache.org>.
stevomitric commented on PR #57225:
URL: https://github.com/apache/spark/pull/57225#issuecomment-4992307009
cc @cloud-fan, @MaxGekk PTAL.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-57816][SQL] Support nanosecond-precision timestamps in date_format, to_char and to_varchar [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on PR #57225:
URL: https://github.com/apache/spark/pull/57225#issuecomment-4992787966
can you fix merge conflicts?
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org