Skip to content
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

[GLUTEN-6202][VL] No extra SortExec needed before WindowExec if window type is sort #6203

Closed
wants to merge 4 commits into from

Conversation

WangGuangxin
Copy link
Contributor

What changes were proposed in this pull request?

When spark.gluten.sql.columnar.backend.velox.window.type is set to sort, there should be no extra SortExec before WindowExec in plan.

(Fixes: #6202)

How was this patch tested?

Mannual Test and UT

Copy link

#6202

Copy link

Run Gluten Clickhouse CI

Copy link

Run Gluten Clickhouse CI

@WangGuangxin
Copy link
Contributor Author

cc @JkSelf

Copy link

Run Gluten Clickhouse CI

Copy link
Member

@zhztheplayer zhztheplayer left a comment

Choose a reason for hiding this comment

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

Thanks.

child
case p @ ProjectExec(_, SortExec(_, false, child, _))
if outputOrderSatisfied(child, transformer.requiredChildOrdering) =>
p.copy(child = child)
Copy link
Member

Choose a reason for hiding this comment

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

Any reason not using p.withNewChildren to keep tags?

Comment on lines 260 to 420
private def outputOrderSatisfied(child: SparkPlan, required: Seq[Seq[SortOrder]]): Boolean = {
Seq(child).zip(required).forall {
case (child, requiredOrdering) =>
SortOrder.orderingSatisfies(child.outputOrdering, requiredOrdering)
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Could just assume an unary node is returned from replace.doReplace(window) then we can avoid zip to simplify code.

Copy link

Run Gluten Clickhouse CI

Copy link
Member

@zhztheplayer zhztheplayer left a comment

Choose a reason for hiding this comment

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

Just one nit left, thank you for the update.

Comment on lines 246 to 247
val transformer = replace.doReplace(window)
val newChild = transformer.children.head match {
Copy link
Member

Choose a reason for hiding this comment

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

Oops, let's either add an assertion like assert(transformer.children.size == 1), or cast it to a unary node.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok,got it

@zhztheplayer
Copy link
Member

And CH CI failed https://opencicd.kyligence.com/job/gluten/job/gluten-ci/10302/, please also take a look. Thanks.

Copy link

Run Gluten Clickhouse CI

Copy link

github-actions bot commented Jul 2, 2024

Run Gluten Clickhouse CI

Copy link

github-actions bot commented Jul 2, 2024

Run Gluten Clickhouse CI

Copy link

github-actions bot commented Jul 3, 2024

Run Gluten Clickhouse CI

Copy link

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the stale stale label Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[VL] No extra SortExec needed before WindowExec if window type is sort
2 participants