You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "lokeshj1703 (via GitHub)" <gi...@apache.org> on 2023/02/15 07:38:54 UTC

[GitHub] [hudi] lokeshj1703 opened a new pull request, #7958: Fix Spark partition validation in TestBulkInsertInternalPartitionerForRows

lokeshj1703 opened a new pull request, #7958:
URL: https://github.com/apache/hudi/pull/7958

   ### Change Logs
   
   
   This PR fixes the test failure in `TestBulkInsertInternalPartitionerForRows#testBulkInsertInternalPartitioner` with `GLOBAL_SORT`. The behavior of `GlobalSortPartitionerWithRows`(`BulkInsertSortMode.GLOBAL_SORT`) is the same as before.  The new assertion on the number of output partitions added in the test causes it to fail, because `df.sort` may generate smaller number of partitions than the specified parallelism.
   ```
   [ERROR] testBulkInsertInternalPartitioner{BulkInsertSortMode, boolean, boolean, boolean, boolean}[1]  Time elapsed: 0.961 s  <<< FAILURE!
   org.opentest4j.AssertionFailedError: expected: <2> but was: <1>
   	at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
   	at org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)
   	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:150)
   	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:145)
   	at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:510)
   	at org.apache.hudi.execution.bulkinsert.TestBulkInsertInternalPartitionerForRows.testBulkInsertInternalPartitioner(TestBulkInsertInternalPartitionerForRows.java:152)
   	at org.apache.hudi.execution.bulkinsert.TestBulkInsertInternalPartitionerForRows.testBulkInsertInternalPartitioner(TestBulkInser
   ```
   
   ### Impact
   
   NA
   
   ### Risk level (write none, low medium or high below)
   
   LOW
   
   ### Documentation Update
   
   _Describe any necessary documentation update if there is any new feature, config, or user-facing change_
   
   - _The config description must be updated if new configs are added or the default value of the configs are changed_
   - _Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the
     ticket number here and follow the [instruction](https://hudi.apache.org/contribute/developer-setup#website) to make
     changes to the website._
   
   ### Contributor's checklist
   
   - [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [ ] Change Logs and Impact were stated clearly
   - [ ] Adequate tests were added if applicable
   - [ ] CI passed
   


-- 
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: commits-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] hudi-bot commented on pull request #7958: [HUDI-5799] Fix Spark partition validation in TestBulkInsertInternalPartitionerForRows

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #7958:
URL: https://github.com/apache/hudi/pull/7958#issuecomment-1430893211

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "36c706d1bb1a8f793ce874c9316aaf829aecd594",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "36c706d1bb1a8f793ce874c9316aaf829aecd594",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 36c706d1bb1a8f793ce874c9316aaf829aecd594 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] hudi-bot commented on pull request #7958: [HUDI-5799] Fix Spark partition validation in TestBulkInsertInternalPartitionerForRows

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #7958:
URL: https://github.com/apache/hudi/pull/7958#issuecomment-1431561986

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "36c706d1bb1a8f793ce874c9316aaf829aecd594",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15199",
       "triggerID" : "36c706d1bb1a8f793ce874c9316aaf829aecd594",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 36c706d1bb1a8f793ce874c9316aaf829aecd594 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15199) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] hudi-bot commented on pull request #7958: [HUDI-5799] Fix Spark partition validation in TestBulkInsertInternalPartitionerForRows

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #7958:
URL: https://github.com/apache/hudi/pull/7958#issuecomment-1430939533

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "36c706d1bb1a8f793ce874c9316aaf829aecd594",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15199",
       "triggerID" : "36c706d1bb1a8f793ce874c9316aaf829aecd594",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 36c706d1bb1a8f793ce874c9316aaf829aecd594 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15199) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] codope commented on a diff in pull request #7958: [HUDI-5799] Fix Spark partition validation in TestBulkInsertInternalPartitionerForRows

Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #7958:
URL: https://github.com/apache/hudi/pull/7958#discussion_r1108713465


##########
hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/execution/bulkinsert/TestBulkInsertInternalPartitionerForRows.java:
##########
@@ -172,9 +173,14 @@ private void testBulkInsertInternalPartitioner(BulkInsertPartitioner partitioner
       return;
     }
     Dataset<Row> actualRecords = (Dataset<Row>) partitioner.repartitionRecords(rows, numPartitions);
-    assertEquals(
-        enforceNumOutputPartitions ? numPartitions : rows.rdd().getNumPartitions(),
-        actualRecords.rdd().getNumPartitions());
+    if (isGloballySorted) {
+      // For GLOBAL_SORT, `df.sort` may generate smaller number of partitions than the specified parallelism
+      assertTrue(actualRecords.rdd().getNumPartitions() <= numPartitions);

Review Comment:
   would like to understand why this is the behavior. what's affecting the number of partitions? is it the size of data?



-- 
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: commits-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] lokeshj1703 commented on a diff in pull request #7958: [HUDI-5799] Fix Spark partition validation in TestBulkInsertInternalPartitionerForRows

Posted by "lokeshj1703 (via GitHub)" <gi...@apache.org>.
lokeshj1703 commented on code in PR #7958:
URL: https://github.com/apache/hudi/pull/7958#discussion_r1109597042


##########
hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/execution/bulkinsert/TestBulkInsertInternalPartitionerForRows.java:
##########
@@ -172,9 +173,14 @@ private void testBulkInsertInternalPartitioner(BulkInsertPartitioner partitioner
       return;
     }
     Dataset<Row> actualRecords = (Dataset<Row>) partitioner.repartitionRecords(rows, numPartitions);
-    assertEquals(
-        enforceNumOutputPartitions ? numPartitions : rows.rdd().getNumPartitions(),
-        actualRecords.rdd().getNumPartitions());
+    if (isGloballySorted) {
+      // For GLOBAL_SORT, `df.sort` may generate smaller number of partitions than the specified parallelism
+      assertTrue(actualRecords.rdd().getNumPartitions() <= numPartitions);

Review Comment:
   This is happening because Global Sort Bulk Insert partitioner is using coalesce instead of repartition.



-- 
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: commits-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] codope merged pull request #7958: [HUDI-5799] Fix Spark partition validation in TestBulkInsertInternalPartitionerForRows

Posted by "codope (via GitHub)" <gi...@apache.org>.
codope merged PR #7958:
URL: https://github.com/apache/hudi/pull/7958


-- 
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: commits-unsubscribe@hudi.apache.org

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