Skip to content

Commit

Permalink
[HUDI-4530] fix default payloadclass in mor is different with cow (ap…
Browse files Browse the repository at this point in the history
  • Loading branch information
KnightChess authored and fengjian committed Apr 5, 2023
1 parent 29862d7 commit c6d85dd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package org.apache.spark.sql.hudi

import org.apache.hudi.DataSourceWriteOptions
import org.apache.hudi.avro.HoodieAvroUtils.getRootLevelFieldName
import org.apache.hudi.common.model.DefaultHoodieRecordPayload
import org.apache.hudi.common.table.HoodieTableConfig
import org.apache.hudi.common.util.ValidationUtils
import org.apache.spark.sql.SparkSession
Expand Down Expand Up @@ -67,7 +66,7 @@ object HoodieOptionConfig {
.withSqlKey("payloadClass")
.withHoodieKey(DataSourceWriteOptions.PAYLOAD_CLASS_NAME.key)
.withTableConfigKey(HoodieTableConfig.PAYLOAD_CLASS_NAME.key)
.defaultValue(classOf[DefaultHoodieRecordPayload].getName)
.defaultValue(DataSourceWriteOptions.PAYLOAD_CLASS_NAME.defaultValue())
.build()

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ class TestHoodieOptionConfig extends SparkClientFunctionalTestHarness {
assertTrue(with1.size == 3)
assertTrue(with1("primaryKey") == "id")
assertTrue(with1("type") == "cow")
assertTrue(with1("payloadClass") == classOf[DefaultHoodieRecordPayload].getName)
assertTrue(with1("payloadClass") == classOf[OverwriteWithLatestAvroPayload].getName)

val ops2 = Map("primaryKey" -> "id",
"preCombineField" -> "timestamp",
"type" -> "mor",
"payloadClass" -> classOf[OverwriteWithLatestAvroPayload].getName
"payloadClass" -> classOf[DefaultHoodieRecordPayload].getName
)
val with2 = HoodieOptionConfig.withDefaultSqlOptions(ops2)
assertTrue(ops2 == with2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,8 @@ class TestMergeIntoTable extends HoodieSparkSqlTestBase {
| tblproperties (
| type = '$tableType',
| primaryKey = 'id',
| preCombineField = 'v'
| preCombineField = 'v',
| hoodie.compaction.payload.class = 'org.apache.hudi.common.model.DefaultHoodieRecordPayload'
| )
| partitioned by(dt)
| location '${tmp.getCanonicalPath}/$tableName1'
Expand Down

0 comments on commit c6d85dd

Please sign in to comment.