pyspark.sql.functions.
years
Partition transform function: A transform for timestamps and dates to partition data into years.
New in version 3.1.0.
Changed in version 3.4.0: Supports Spark Connect.
Column
target date or timestamp column to work on.
data partitioned by years.
Notes
This function can be used only in combination with partitionedBy() method of the DataFrameWriterV2.
partitionedBy()
Examples
>>> df.writeTo("catalog.db.table").partitionedBy( ... years("ts") ... ).createOrReplace()