Skip to content

Commit

Permalink
[HUDI-8566] Test coverage of default hoodie avro payload class for MIT
Browse files Browse the repository at this point in the history
  • Loading branch information
Davis-Zhang-Onehouse committed Nov 22, 2024
1 parent ae5833e commit 63429f7
Showing 1 changed file with 0 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,83 +185,6 @@ class TestMergeIntoTable extends HoodieSparkSqlTestBase with ScalaAssertionSuppo
}
}


/**
* Test MIT with global index.
* HUDI-7131
*/
test("Test Merge Into with Global Index") {
if (HoodieSparkUtils.gteqSpark3_3) {
withRecordType()(withTempDir { tmp =>
withSQLConf("hoodie.index.type" -> "GLOBAL_BLOOM") {
val targetTable = generateTableName
spark.sql(
s"""
|create table ${targetTable} (
| id int,
| version int,
| name string,
| inc_day string
|) using hudi
|tblproperties (
| type = 'cow',
| primaryKey = 'id'
| )
|partitioned by (inc_day)
|location '${tmp.getCanonicalPath}/$targetTable'
|""".stripMargin)
spark.sql(
s"""
|merge into ${targetTable} as target
|using (
|select 1 as id, 1 as version, 'str_1' as name, '2023-10-01' as inc_day
|) source
|on source.id = target.id
|when matched then
|update set *
|when not matched then
|insert *
|""".stripMargin)
spark.sql(
s"""
|merge into ${targetTable} as target
|using (
|select 1 as id, 2 as version, 'str_2' as name, '2023-10-01' as inc_day
|) source
|on source.id = target.id
|when matched then
|update set *
|when not matched then
|insert *
|""".stripMargin)

checkAnswer(s"select id, version, name, inc_day from $targetTable")(
Seq(1, 2, "str_2", "2023-10-01")
)
// migrate the record to a new partition.

spark.sql(
s"""
|merge into ${targetTable} as target
|using (
|select 1 as id, 2 as version, 'str_2' as name, '2023-10-02' as inc_day
|) source
|on source.id = target.id
|when matched then
|update set *
|when not matched then
|insert *
|""".stripMargin)

checkAnswer(s"select id, version, name, inc_day from $targetTable")(
Seq(1, 2, "str_2", "2023-10-02")
)
}
})
spark.sessionState.conf.unsetConf("hoodie.index.type")
}
}

test("Test MergeInto with ignored record") {
withRecordType()(withTempDir {tmp =>
spark.sql("set hoodie.payload.combined.schema.validate = true")
Expand Down

0 comments on commit 63429f7

Please sign in to comment.