[SUPPORT] Upgrading table through CLI changes from CustomKeyGenerator to SimpleKeyGenerator
- Dominant language
- Java
- Stars
- 6.2k
- Forks
- 2.5k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 111
Description
**Describe the problem you faced**
We found some old tables that were still table version `2` , these failed when trying to be read with Hudi 0.14.1 Spark jobs (could not recognize the `hoodie.properties` file).
To remediate I created a Spark job running with Hudi 0.12.2 so that I could run the `upgrade table` command to upgrade from table version 2 to table version 5 (and then in ingestion this would be upgraded to table version 6 on Hudi 0.14.1)
I was surprised to see the key generator class was changed/broken by the CLI:
```
╟─────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ fileSystem │ s3 ║
╟─────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.table.name │ ... ║
╟─────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.table.recordkey.fields │ _id ║
╟─────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.table.type │ COPY_ON_WRITE ║
╟─────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.table.precombine.field │ published_at ║
╟─────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.table.partition.fields │ dt ║
╟─────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.table.keygenerator.class │ org.apache.hudi.keygen.CustomKeyGenerator ║
╟─────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.populate.meta.fields │ true ║
╟─────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.archivelog.folder │ archived ║
╟─────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.table.base.file.format │ PARQUET ║
╟─────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.timeline.layout.version │ 1 ║
╟─────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.table.version │ 2 ║
╚═════════════════════════════════╧════════════════════════════════════════════════════════════════════════╝
```
```
╟─────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ fileSystem │ s3 ║
╟─────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.table.type │ COPY_ON_WRITE ║
╟─────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.table.precombine.field │ published_at ║
╟─────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.table.partition.fields │ dt ║
╟─────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.archivelog.folder │ archived ║
╟─────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.timeline.layout.version │ 1 ║
╟─────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.table.checksum │ 662017575 ║
╟─────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.table.name │ ... ║
╟─────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.table.recordkey.fields │ _id ║
╟─────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.datasource.write.hive_style_partitioning │ false ║
╟─────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.table.keygenerator.class │ org.apache.hudi.keygen.SimpleKeyGenerator ║
╟─────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.populate.meta.fields │ true ║
╟─────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.table.base.file.format │ PARQUET ║
╟─────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.datasource.write.partitionpath.urlencode │ false ║
╟─────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────╢
║ hoodie.table.version │ 5 ║
╚═════════════════════════════════════════════════╧════════════════════════════════════════════════════════════════════════╝
```
**To Reproduce**
Steps to reproduce the behavior:
Create a table on Hudi 0.9.0, then run `upgrade table` to table version 5.
**Expected behavior**
The key generator should _not_ be overwritten.
**Environment Description**
* Hudi version : 0.12.2
* Spark version : 3.3.1
* Hive version :
* Hadoop version :
* Storage (HDFS/S3/GCS..) :
* Running on Docker? (yes/no) :
**Additional context**
This was done on EMR
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the `upgrade table` CLI flow and reproduce the upgrade from table version 2 to version 5 using the stated Hudi and Spark versions. Trace how the existing `hoodie.table.keygenerator.class` value is handled; done means the upgrade preserves `CustomKeyGenerator` instead of changing it to `SimpleKeyGenerator`.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spark
- Domain
- cli, data-engineering
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100