jonvex commented on issue #7294:
URL: https://github.com/apache/hudi/issues/7294#issuecomment-1344934173
I put this test in TestCreateTable.scala and it succeeds without error
```
test("Test Multiple Primary Key Default Keygen") {
withTempDir { tmp =>
val tableName = generateTableName
spark.sql(
s"""
|create table $tableName (
| id int,
| name string,
| price double,
| ts long
|) using hudi
| partitioned by (name)
| tblproperties (
| primaryKey = 'id,price',
| preCombineField = 'ts',
| type = 'cow'
| )
| location '${tmp.getCanonicalPath}'
""".stripMargin)
val table =
spark.sessionState.catalog.getTableMetadata(TableIdentifier(tableName))
val tablePath = table.storage.properties("path")
val metaClient = HoodieTableMetaClient.builder()
.setBasePath(tablePath)
.setConf(spark.sessionState.newHadoopConf())
.build()
val tableConfig = metaClient.getTableConfig.getProps.asScala.toMap
assertResult("org.apache.hudi.keygen.ComplexKeyGenerator")(tableConfig(HoodieTableConfig.KEY_GENERATOR_CLASS_NAME.key()))
val source = scala.io.Source.fromFile(tmp.getCanonicalPath +
"/.hoodie/hoodie.properties")
val lines = try source.mkString finally source.close()
assertResult(lines.contains("hoodie.table.recordkey.fields=id,price"))(true)
assertResult(lines.contains("hoodie.table.keygenerator.class=org.apache.hudi.keygen.ComplexKeyGenerator"))(true)
}
}
```
--
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]