Skip to content

branch-4.2: [refactor](local shuffle) Move local exchange planning from BE to FE #63366 - #68184

Closed
924060929 wants to merge 1 commit into
auto-pick-64458-branch-4.2from
auto-pick-63366-branch-4.2
Closed

924060929 wants to merge 1 commit into
auto-pick-64458-branch-4.2from
auto-pick-63366-branch-4.2

Conversation

@924060929

Copy link
Copy Markdown
Contributor

Cherry-picked from #63366

@924060929
924060929 requested a review from yiguolei as a code owner September 18, 2026 09:29
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@924060929

Copy link
Copy Markdown
Contributor Author

run buildall

@924060929

Copy link
Copy Markdown
Contributor Author

/review

@924060929

Copy link
Copy Markdown
Contributor Author

Superseded by #68199, which backports the whole local shuffle series as one PR.

@924060929 924060929 closed this Sep 18, 2026

@github-actions github-actions Bot left a comment

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.

Static review of the pinned head 392a6c4 against base c41194b found four blocking issues.

  • The BE cannot compile because AdaptivePassthroughExchanger initializes an unrelated Exchanger specialization.
  • The changed BE aggregation test still uses the removed ExchangeType enum.
  • The FE cannot compile because SetOperationNode references an undeclared distributionMode field.
  • FE aggregation planning can insert PASSTHROUGH LocalExchange nodes for serial non-ScanNode children, splitting the AggSink/AggSource pipeline and reproducing the empty-source-deps crash/hang documented by the added Bug 21 regression.

The supplied review focus has no additional focus points. This is a static review only; no builds or tests were run per the review contract.

@github-actions github-actions Bot left a comment

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.

Corrected exact-head static review for 392a6c4 against c41194b. The review found four blocking issues.

  • The BE cannot compile because AdaptivePassthroughExchanger initializes an unrelated Exchanger specialization.
  • The changed BE aggregation test still uses the removed ExchangeType enum.
  • The FE cannot compile because SetOperationNode references an undeclared distributionMode field.
  • FE aggregation planning can insert PASSTHROUGH LocalExchange nodes for serial non-ScanNode children, splitting the AggSink/AggSource pipeline and reproducing the empty-source-deps crash/hang documented by the added Bug 21 regression.

The supplied review focus has no additional focus points. This is a static review only; no builds or tests were run per the review contract.

int free_block_limit)
: Exchanger<BlockWrapperSPtr>(running_sink_operators, num_partitions,
free_block_limit) {
: Exchanger<PartitionedBlock>(running_sink_operators, num_partitions, free_block_limit,

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.

AdaptivePassthroughExchanger still derives from Exchanger<BlockWrapperSPtr>, but this constructor now initializes Exchanger<PartitionedBlock>. That specialization is not a direct base, so this is a hard C++ compile error (and the implementation still consumes BlockWrapperSPtr). Please initialize Exchanger<BlockWrapperSPtr> here.

sink_op->_needs_finalize = false;
OperatorPtr child =
std::make_shared<MockDistributionOperator>(ExchangeType::ADAPTIVE_PASSTHROUGH);
std::make_shared<MockDistributionOperator>(TLocalPartitionType::ADAPTIVE_PASSTHROUGH);

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.

This test still uses the deleted ExchangeType at lines 146, 151, and 156, but this PR removes that enum from dependency.h and uses TLocalPartitionType::type instead. The test target therefore fails to compile; replace these references with the corresponding TLocalPartitionType values.

}

public boolean isBucketShuffle() {
return distributionMode.equals(DistributionMode.BUCKET_SHUFFLE);

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.

SetOperationNode.isBucketShuffle() uses distributionMode, but this class (and PlanNode) declares no such field; the only analogous state is HashJoinNode.distrMode. This unresolved symbol prevents the FE module from compiling. Please remove/fix this method or add the correctly initialized set-operation state.


/** BE base class required_data_distribution: serial child → PASSTHROUGH, else → NOOP. */
private LocalExchangeTypeRequire baseClassRequire(ConnectContext connectContext) {
return children.get(0).isSerialOperatorOnBe(connectContext)

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.

This helper turns every serial child into a PASSTHROUGH requirement, including serial Exchange/Agg children. That causes FE to insert a PASSTHROUGH LocalExchange between the serial UNPARTITIONED Exchange/Agg and the streaming/distinct pre-agg, splitting the coupled AggSink/AggSource pipeline (the added Bug 21 regression documents the resulting empty-source-deps crash/hang). Restrict this fallback to the safe ScanNode case (or mirror the BE serial-ancestor boundary check) before inserting the LocalExchange.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants