Skip to content

[GLUTEN-10988][VL] Do not resize batches for sort-based/rss-sort shuffle#10991

Merged
marin-ma merged 5 commits intoapache:mainfrom
wForget:GLUTEN-10988
Nov 5, 2025
Merged

[GLUTEN-10988][VL] Do not resize batches for sort-based/rss-sort shuffle#10991
marin-ma merged 5 commits intoapache:mainfrom
wForget:GLUTEN-10988

Conversation

@wForget
Copy link
Copy Markdown
Member

@wForget wForget commented Oct 31, 2025

What changes are proposed in this pull request?

The sort-based shuffle reader already respects the batch size configuration, so we don't need to support resizeBatches.shuffleOutput for it.

sort:
https://github.com/apache/incubator-gluten/blob/2f7b138f24f16a249cea57217e50962d3b1a8ee4/cpp/velox/shuffle/VeloxShuffleReader.cc#L602
rss-sort:
https://github.com/apache/incubator-gluten/blob/2f7b138f24f16a249cea57217e50962d3b1a8ee4/cpp/velox/shuffle/VeloxShuffleReader.cc#L766

closes #10988

How was this patch tested?

@marin-ma
Copy link
Copy Markdown
Contributor

marin-ma commented Oct 31, 2025

Could you only remove this for the specific shuffle writer type SortShuffleWriterType and RssSortShuffleWriterType? There's going to be more shuffle writer type such as gpu shuffle writer in the future.

@wForget wForget changed the title [GLUTEN-10988][VL] Make resizeBatches.shuffleOutput work only for hash shuffle [GLUTEN-10988][VL] Do not resize batches for sort-based/rss-sort shuffle Nov 3, 2025
@wForget
Copy link
Copy Markdown
Member Author

wForget commented Nov 3, 2025

Could you only remove this for the specific shuffle writer type SortShuffleWriterType and RssSortShuffleWriterType? There's going to be more shuffle writer type such as gpu shuffle writer in the future.

@marin-ma Thank you. I have only removed support for SortShuffleWriterType/RssSortShuffleWriterType. Could you please take another look?

case shuffle: ColumnarShuffleExchangeExec
if shuffle.shuffleWriterType == HashShuffleWriterType &&
VeloxConfig.get.veloxResizeBatchesShuffleInput =>
case ColumnarResizeableShuffleExchangeExec(shuffle) if resizeBatchesShuffleInputEnabled =>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this change assumes a specific shuffle writer type requires both shuffle input and output require resizing at the same time, but I don't think that's necessarily true. We may assume for a shuffle type it may need input resizing but not output resizing, and vice versa. (Although for the existing types they are the same).

Maybe we can generalize this by adding these flags to the ShuffleWriterType trait:

trait ShuffleWriterType {
  val name: String
  val requiresResizingShuffleInput: Boolean
  val requiresResizingShuffleOutput: Boolean
}

What do you think?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, sounds good. I’ll make that change.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marin-ma Thank you for your suggestion, I have updated it. Also, do we need to change the default value of COLUMNAR_VELOX_RESIZE_BATCHES_SHUFFLE_OUTPUT to true?
https://github.com/apache/incubator-gluten/blob/95f271d7f683deb9d61fb019806d6d221d0fc6c9/backends-velox/src/main/scala/org/apache/gluten/config/VeloxConfig.scala#L279-L286

@github-actions github-actions Bot added the CORE works for Gluten Core label Nov 4, 2025
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Nov 4, 2025

Run Gluten Clickhouse CI on x86

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Nov 4, 2025

Run Gluten Clickhouse CI on x86

@wForget wForget requested a review from marin-ma November 5, 2025 01:27
trait ShuffleWriterType {
val name: String
val requiresResizingShuffleInput: Boolean = true
val requiresResizingShuffleOutput: Boolean = true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move these into HashShuffleWriterType

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, updated

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Nov 5, 2025

Run Gluten Clickhouse CI on x86

Copy link
Copy Markdown
Contributor

@marin-ma marin-ma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@marin-ma marin-ma merged commit 45f2e72 into apache:main Nov 5, 2025
100 of 101 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CORE works for Gluten Core VELOX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[VL] Makes resizeBatches.shuffleOutput work only for hash shuffle

2 participants