Note
Kailangan ng pahintulot para ma-access ang page na ito. Maaari mong subukang mag-sign in o magpalit ng mga direktoryo.
Ang pag-access sa pahinang ito ay nangangailangan ng pahintulot. Maaari mong subukang baguhin ang mga direktoryo.
Partition transform function: A transform for timestamps and dates to partition data into years. Supports Spark Connect.
Warning
Deprecated in 4.0.0. Use partitioning.years instead.
Syntax
from pyspark.sql import functions as dbf
dbf.years(col=<col>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or str |
Target date or timestamp column to work on. |
Returns
pyspark.sql.Column: Data partitioned by years.
Examples
df.writeTo("catalog.db.table").partitionedBy(
years("ts")
).createOrReplace()
Note
This function can be used only in combination with the partitionedBy method of the DataFrameWriterV2.