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

fix: Native window operator should be CometUnaryExec #774

Merged
merged 1 commit into from
Aug 4, 2024

Conversation

viirya
Copy link
Member

@viirya viirya commented Aug 4, 2024

Which issue does this PR close?

Closes #775.

Rationale for this change

What changes are included in this PR?

How are these changes tested?

this.partitionSpec == other.partitionSpec && this.orderSpec == other.orderSpec &&
this.serializedPlanOpt == other.serializedPlanOpt
case _ =>
false
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This native plan is incorrect. This uses the window operator's output as the pseudo scan's output, but it should be the child plan's output. The incorrect output causes errors in DataFusion Window operator.

Copy link
Member Author

@viirya viirya Aug 4, 2024

Choose a reason for hiding this comment

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

Besides, native window operator requires correct partitioning and ordering information from its child operator. The current native scan operator doesn't have these information. That also causes DataFusion Window operator cannot produce correct ordering partition by info.

}

object CometWindowExec {
def getNativePlan(
Copy link
Member Author

Choose a reason for hiding this comment

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

Because Window is native operator, we should chain it in the native operators instead of creating a pseudo scan for it.

Copy link
Member Author

Choose a reason for hiding this comment

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

It also can improve performance as we don't need additional native/JVM bridge.

Copy link
Contributor

@huaxingao huaxingao left a comment

Choose a reason for hiding this comment

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

Thanks for catching the problem!

@viirya viirya merged commit a635798 into apache:main Aug 4, 2024
75 checks passed
@viirya
Copy link
Member Author

viirya commented Aug 4, 2024

Thanks @huaxingao

@viirya viirya deleted the fix_window_op branch August 4, 2024 02:55
himadripal pushed a commit to himadripal/datafusion-comet that referenced this pull request Sep 7, 2024
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.

Native window operator should be CometUnaryExec
2 participants