coded9 commented on code in PR #8948:
URL: https://github.com/apache/iceberg/pull/8948#discussion_r1377025066
##########
spark/v3.5/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestMerge.java:
##########
@@ -1019,21 +1015,21 @@ public void
testMergeWithMultipleUpdatesForTargetRowSmallTargetLargeSourceNoNotM
Dataset<Integer> ds = spark.createDataset(sourceIds, Encoders.INT());
ds.union(ds).createOrReplaceTempView("source");
- String errorMsg = "a single row from the target table with multiple rows
of the source table";
- AssertHelpers.assertThrowsCause(
- "Should complain about multiple matches",
- SparkRuntimeException.class,
- errorMsg,
- () -> {
- sql(
- "MERGE INTO %s AS t USING source AS s "
- + "ON t.id > s.value "
- + "WHEN MATCHED AND t.id = 1 THEN "
- + " UPDATE SET id = 10 "
- + "WHEN MATCHED AND t.id = 6 THEN "
- + " DELETE",
- commitTarget());
- });
+ String errorMsg = "MERGE statement matched a single row from the target
table with multiple rows of the source table.";
+ Assertions.assertThatThrownBy(
+ () -> {
+ sql(
+ "MERGE INTO %s AS t USING source AS s "
+ + "ON t.id > s.value "
+ + "WHEN MATCHED AND t.id = 1 THEN "
+ + " UPDATE SET id = 10 "
+ + "WHEN MATCHED AND t.id = 6 THEN "
+ + " DELETE",
+ commitTarget());
+ })
+ .cause()
+ .isInstanceOf(SparkRuntimeException.class)
+ .hasMessageContaining(errorMsg);
Review Comment:
```
[MERGE_CARDINALITY_VIOLATION] The ON search condition of the MERGE statement
matched a single row from the target table with multiple rows of the source
table.
This could result in the target row being operated on more than once with an
update or delete operation and is not allowed.
```
This is the complete error message
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]