You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "nastra (via GitHub)" <gi...@apache.org> on 2023/04/25 07:16:34 UTC

[GitHub] [iceberg] nastra commented on a diff in pull request #7424: Spark 3.4: Add tests for SPJ when partition keys mismatch

nastra commented on code in PR #7424:
URL: https://github.com/apache/iceberg/pull/7424#discussion_r1176103017


##########
spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestStoragePartitionedJoinsInRowLevelOperations.java:
##########
@@ -257,14 +261,22 @@ private void checkMerge(RowLevelOperationMode mode) {
           SparkPlan plan =
               executeAndKeepPlan(
                   "MERGE INTO %s AS t USING %s AS s "
-                      + "ON t.id = s.id AND t.dep = s.dep AND t.dep = 'hr'"
+                      + "ON t.id = s.id AND t.dep = s.dep "
                       + "WHEN MATCHED THEN "
                       + "  UPDATE SET t.salary = s.salary "
                       + "WHEN NOT MATCHED THEN "
                       + "  INSERT *",
                   tableName, tableName(OTHER_TABLE_NAME));
           String planAsString = plan.toString();
-          Assert.assertFalse("Should be no shuffles with SPJ", planAsString.contains("Exchange"));
+          if (mode == COPY_ON_WRITE) {
+            int actualNumShuffles = StringUtils.countMatches(planAsString, "Exchange");
+            Assert.assertEquals("Should be 1 shuffle with SPJ", 1, actualNumShuffles);
+            Assert.assertTrue(

Review Comment:
   nit: using `Assertions.assertThat(planAsString).contains(...)` / `Assertions.assertThat(planAsString).doesNotContain(...)` will actually give you the entire `planAsString` in case the assertion ever fails (which makes debugging much easier)



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org