Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HUDI-8566] Test coverage of default hoodie avro payload class for MIT #12318

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading