You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2023/01/16 16:38:39 UTC

[GitHub] [arrow-datafusion] andygrove opened a new pull request, #4926: WIP: Remove redundant repartitioning

andygrove opened a new pull request, #4926:
URL: https://github.com/apache/arrow-datafusion/pull/4926

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes https://github.com/apache/arrow-datafusion/issues/4925
   
   See issue for full description of the problem that this PR resolves.
   
   # Rationale for this change
   
   Why repartition twice when we can repartition once?
   
   ## Test Approach
   
   ```bash
   ./target/release/tpch benchmark datafusion --format parquet --partitions 48 --path /mnt/bigdata/tpch/sf10-parquet/ --query 2 --iterations 10 --debug
   ```
   
   ## Before
   
   Before this PR we have 2 instances of `RepartitionExec` in the plan for each table that is an input to a join.
   
   ```
                                 CoalesceBatchesExec: target_batch_size=8192, metrics=[output_rows=0, elapsed_compute=20.396µs, spill_count=0, spilled_bytes=0, mem_used=0]
                                   RepartitionExec: partitioning=Hash([Column { name: "r_regionkey", index: 0 }], 48), metrics=[fetch_time=69.603684ms, send_time=48ns, repart_time=48ns]
                                     RepartitionExec: partitioning=RoundRobinBatch(48), metrics=[fetch_time=479.696µs, send_time=1ns, repart_time=1ns]
                                       CoalesceBatchesExec: target_batch_size=8192, metrics=[output_rows=0, elapsed_compute=320ns, spill_count=0, spilled_bytes=0, mem_used=0]
                                         FilterExec: r_name@1 = EUROPE, metrics=[output_rows=0, elapsed_compute=1ns, spill_count=0, spilled_bytes=0, mem_used=0]
                                           ParquetExec: ...
   ```
   
   Query time before this PR:
   
   ```
   Query 2 avg time: 479.53 ms
   ```
   
   ## After
   
   ```
                                 CoalesceBatchesExec: target_batch_size=8192, metrics=[output_rows=0, elapsed_compute=6.855µs, spill_count=0, spilled_bytes=0, mem_used=0]
                                   RepartitionExec: partitioning=Hash([Column { name: "r_regionkey", index: 0 }], 48), metrics=[fetch_time=322.318µs, send_time=1ns, repart_time=1ns]
                                     CoalesceBatchesExec: target_batch_size=8192, metrics=[output_rows=0, elapsed_compute=281ns, spill_count=0, spilled_bytes=0, mem_used=0]
                                       FilterExec: r_name@1 = EUROPE, metrics=[output_rows=0, elapsed_compute=1ns, spill_count=0, spilled_bytes=0, mem_used=0]
                                         ParquetExec: ...
   ```
   
   Query time after this PR:
   
   ```
   Query 2 avg time: 457.25 ms
   ```
   
   
   # What changes are included in this PR?
   
   New physical optimizer rule
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   # Are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   # Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api change` label.
   -->


-- 
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: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow-datafusion] andygrove closed pull request #4926: WIP: Remove redundant repartitioning

Posted by GitBox <gi...@apache.org>.
andygrove closed pull request #4926: WIP: Remove redundant repartitioning
URL: https://github.com/apache/arrow-datafusion/pull/4926


-- 
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: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow-datafusion] Dandandan commented on pull request #4926: WIP: Remove redundant repartitioning

Posted by GitBox <gi...@apache.org>.
Dandandan commented on PR #4926:
URL: https://github.com/apache/arrow-datafusion/pull/4926#issuecomment-1384326722

   The repartitioning isn't really redundant though? 
   Suppose we only read from one parquet file and do repartition by hash after, we would gain parallelism by first doing a (fast) round robin partition, and a (slower) hash repartition which can now be parallelized.
   
   The round robin repartitioning however would benefit from being also down the `FilterExec` in this case.


-- 
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: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow-datafusion] andygrove commented on pull request #4926: WIP: Remove redundant repartitioning

Posted by GitBox <gi...@apache.org>.
andygrove commented on PR #4926:
URL: https://github.com/apache/arrow-datafusion/pull/4926#issuecomment-1384468555

   I'm unsure now if there is value in continuing with this. Will give it some more thought.


-- 
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: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow-datafusion] andygrove commented on pull request #4926: WIP: Remove redundant repartitioning

Posted by GitBox <gi...@apache.org>.
andygrove commented on PR #4926:
URL: https://github.com/apache/arrow-datafusion/pull/4926#issuecomment-1384372325

   > The repartitioning isn't really redundant though? Suppose we only read from one parquet file and do repartition by hash after, we would gain parallelism by first doing a (fast) round robin partition, and a (slower) hash repartition which can now be parallelized.
   
   That's a good point. The round-robin partitioning is not so fast in Ballista because it introduces an extra query stage with shuffles. Maybe this optimization should just be added in Ballista rather than in DataFusion?
   
   > 
   > The round robin repartitioning however would benefit from being also down the `FilterExec` in this case, so the filtering can benefit from more parallelism as well.
   
   Yes, I also just noticed that.
   
   


-- 
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: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow-datafusion] andygrove commented on pull request #4926: WIP: Remove redundant repartitioning

Posted by GitBox <gi...@apache.org>.
andygrove commented on PR #4926:
URL: https://github.com/apache/arrow-datafusion/pull/4926#issuecomment-1384670404

   Ballista already removes these round-robin repartitions so closing this


-- 
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: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow-datafusion] Dandandan commented on pull request #4926: WIP: Remove redundant repartitioning

Posted by GitBox <gi...@apache.org>.
Dandandan commented on PR #4926:
URL: https://github.com/apache/arrow-datafusion/pull/4926#issuecomment-1384537380

   As far as I remember we are removing the round robin repartitioning in Ballista? (so not introducing a new stage)


-- 
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: github-unsubscribe@arrow.apache.org

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