nsivabalan commented on PR #17787:
URL: https://github.com/apache/hudi/pull/17787#issuecomment-3789019320
```
.option("hoodie.datasource.write.keygenerator.class",
"org.apache.hudi.keygen.TimestampBasedKeyGenerator")
.option("hoodie.keygen.timebased.timestamp.type", "DATE_STRING")
.option("hoodie.keygen.timebased.input.dateformat", "yyyy-MM-dd")
.option("hoodie.keygen.timebased.output.dateformat", "yyyy/MM/dd")
```
This might achieve the same output dir structure you are looking for.
```
spark.sql(
s"""
| CREATE TABLE hudi_table (
| id int,
| name string,
| date_field string
| ) USING HUDI
| PARTITIONED BY (date_field)
| LOCATION '$tablePath'
| TBLPROPERTIES (
| type = 'COPY_ON_WRITE',
| primaryKey = 'id',
| hoodie.datasource.write.partitionpath.field = 'date_field',
| hoodie.table.keygenerator.class =
'org.apache.hudi.keygen.TimestampBasedKeyGenerator',
| hoodie.keygen.timebased.timestamp.type = 'DATE_STRING',
| hoodie.keygen.timebased.input.dateformat = 'yyyy-MM-dd',
| hoodie.keygen.timebased.output.dateformat = 'yyyy/MM/dd'
| )
|""".stripMargin)
spark.sql("INSERT INTO hudi_table VALUES (1, 'test', '2026-01-21')")
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]