Skip to content

Commit

Permalink
use hoodie.datasource.write.operation
Browse files Browse the repository at this point in the history
  • Loading branch information
Zouxxyy committed Oct 17, 2022
1 parent c6b927a commit bb6868a
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ class TestInsertTable extends HoodieSparkSqlTestBase {
}

test("Test enable hoodie.merge.allow.duplicate.on.inserts when write") {
spark.sql("set hoodie.sql.insert.mode = non-strict")
spark.sql("set hoodie.datasource.write.operation = insert")
Seq("mor", "cow").foreach { tableType =>
withTempDir { tmp =>
val tableName = generateTableName
Expand All @@ -925,23 +925,23 @@ class TestInsertTable extends HoodieSparkSqlTestBase {
| )
""".stripMargin)
spark.sql(s"insert into $tableName partition(dt='2021-12-25') values (1, 'a1', 10, 1000)")
checkAnswer(s"select id, name, price, ts, dt from $tableName where id = 1")(
checkAnswer(s"select id, name, price, ts, dt from $tableName")(
Seq(1, "a1", 10, 1000, "2021-12-25")
)
spark.sql("set hoodie.merge.allow.duplicate.on.inserts = false")
spark.sql(s"insert into $tableName partition(dt='2021-12-25') values (1, 'a2', 20, 1001)")
checkAnswer(s"select id, name, price, ts, dt from $tableName where id = 1")(
checkAnswer(s"select id, name, price, ts, dt from $tableName")(
Seq(1, "a2", 20, 1001, "2021-12-25")
)
spark.sql("set hoodie.merge.allow.duplicate.on.inserts = true")
spark.sql(s"insert into $tableName partition(dt='2021-12-25') values (1, 'a3', 30, 1002)")
checkAnswer(s"select id, name, price, ts, dt from $tableName where id = 1")(
checkAnswer(s"select id, name, price, ts, dt from $tableName")(
Seq(1, "a2", 20, 1001, "2021-12-25"),
Seq(1, "a3", 30, 1002, "2021-12-25")
)
}
}
spark.sql("set hoodie.merge.allow.duplicate.on.inserts = false")
spark.sql("set hoodie.sql.insert.mode = upsert")
spark.sql("set hoodie.datasource.write.operation = upsert")
}
}

0 comments on commit bb6868a

Please sign in to comment.