Skip to content

[SPARK-52535][SQL] Improve code readability of rule ApplyColumnarRulesAndInsertTransitions #51227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

zhztheplayer
Copy link
Member

Issue: https://issues.apache.org/jira/browse/SPARK-52535

What changes were proposed in this pull request?

A minor cleanup on the code of ApplyColumnarRulesAndInsertTransitions to improve readability.

Why are the changes needed?

The rule is important for 3rd SQL plugins and the code got messed up a bit during the development iterations back then.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Existing tests.

@github-actions github-actions bot added the SQL label Jun 20, 2025
@@ -537,6 +539,19 @@ case class ApplyColumnarRulesAndInsertTransitions(
false
}
plan.withNewChildren(plan.children.map(insertTransitions(_, outputsColumnar)))
} else {
Copy link
Member Author

Choose a reason for hiding this comment

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

The if-else clause

if (plan.isInstanceOf[ColumnarToRowTransition]) {
  ...
} else {
  ...
}

is inverted here to ensure symmetry with the code in ensureOutputsColumnar.

@zhztheplayer zhztheplayer marked this pull request as draft June 20, 2025 08:24
@zhztheplayer zhztheplayer marked this pull request as ready for review June 20, 2025 09:49
@zhztheplayer
Copy link
Member Author

Would someone like to review the PR? Thanks!

@cloud-fan @revans2

Copy link
Contributor

@revans2 revans2 left a comment

Choose a reason for hiding this comment

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

This looks fine to me

@cloud-fan
Copy link
Contributor

thanks, merging to master!

@cloud-fan cloud-fan closed this in ace03f4 Jul 3, 2025
@zhztheplayer
Copy link
Member Author

@cloud-fan @revans2 Thank you!

asl3 pushed a commit to asl3/spark that referenced this pull request Jul 14, 2025
…sAndInsertTransitions

Issue: https://issues.apache.org/jira/browse/SPARK-52535

### What changes were proposed in this pull request?

A minor cleanup on the code of `ApplyColumnarRulesAndInsertTransitions` to improve readability.

### Why are the changes needed?

The rule is important for 3rd SQL plugins and the code got messed up a bit during the development iterations back then.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Existing tests.

Closes apache#51227 from zhztheplayer/wip-transition-rule-cleanup.

Authored-by: Hongze Zhang <hongze.zzz123@gmail.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants