From 54cf5c8b4f1076a5a2b9fe968cfaf022b387d08c Mon Sep 17 00:00:00 2001 From: Jubin Soni Date: Sun, 28 Jun 2026 10:28:55 -0700 Subject: [PATCH] [SPARK-57742][PYTHON] Add truncation disclaimer to unix_micros docstring MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What is the purpose of the change Fixes SPARK-57742 — adds `"Truncates higher levels of precision."` to the one-line description of `unix_micros`, making it consistent with `unix_millis` and `unix_seconds` which already carry this disclaimer. This became a practical gap once `unix_nanos` (SPARK-57579) made nanosecond-precision timestamps (`TIMESTAMP_LTZ(9)` / `TIMESTAMP_NTZ(9)`) usable: a user passing such a column to `unix_micros` has no indication from the docstring that sub-microsecond digits will be silently dropped. ### Brief change log - `python/pyspark/sql/functions/builtin.py`: appended `"Truncates higher levels of precision."` to the one-line summary of `unix_micros`, matching `unix_millis` and `unix_seconds` ### Verifying this change This is a documentation-only change. No behaviour is altered. - [ ] Confirm `unix_micros` docstring now reads: `"Returns the number of microseconds since 1970-01-01 00:00:00 UTC. Truncates higher levels of precision."` - [ ] Confirm `unix_millis` and `unix_seconds` already carry the same sentence (consistency check) ### Does this pull request potentially affect one of the following parts - Dependencies (does it add or upgrade a dependency): no - The public API, i.e., is any changed class annotated with `@Public`/`@Evolving`: no — docstring only - The serializers: no - The runtime per-record code paths (performance sensitive): no - Anything that affects deployment or recovery: no - The S3 file system connector: no ### Documentation Does this pull request introduce a new feature? No — this is a docstring fix. ### Was generative AI tooling used to co-author this PR? Yes — Claude Code was used as a pair-programming assistant. All changes were reviewed and verified by the author. Generated-by: Claude Opus 4.8 --- python/pyspark/sql/functions/builtin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/pyspark/sql/functions/builtin.py b/python/pyspark/sql/functions/builtin.py index bca4704962f96..ccb2ce8866ef3 100644 --- a/python/pyspark/sql/functions/builtin.py +++ b/python/pyspark/sql/functions/builtin.py @@ -11709,7 +11709,7 @@ def unix_date(col: "ColumnOrName") -> Column: @_try_remote_functions def unix_micros(col: "ColumnOrName") -> Column: - """Returns the number of microseconds since 1970-01-01 00:00:00 UTC. + """Returns the number of microseconds since 1970-01-01 00:00:00 UTC. Truncates higher levels of precision. .. versionadded:: 3.5.0