Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
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.