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

feat: Add support of TakeOrderedAndProjectExec in Comet #88

Merged
merged 5 commits into from
Feb 24, 2024

Conversation

viirya
Copy link
Member

@viirya viirya commented Feb 22, 2024

Which issue does this PR close?

Closes #89.

Rationale for this change

TakeOrderedAndProjectExec is a common operator in Spark. In Comet, we should support it to increase query coverage.

What changes are included in this PR?

How are these changes tested?

Copy link
Contributor

@advancedxy advancedxy left a comment

Choose a reason for hiding this comment

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

LGTM, except one minor comment.

if isCometNative(s.child) && isCometOperatorEnabled(conf, "takeOrderedAndProjectExec")
&& isCometShuffleEnabled(conf) &&
CometTakeOrderedAndProjectExec.isSupported(s.projectList, s.sortOrder, s.child) =>
// TODO: support offset for Spark 3.4
Copy link
Contributor

Choose a reason for hiding this comment

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

One minor comment: this might be a correctness issue for Spark 3.4 with offset > 0 as we simply ignore the possible offset field.

One possible way to address that would be that define a getOffset method in ShimCometSparkSessionExtensions to access offset field via reflection.

Of course it should be addressed in another PR and other xxLimitExec too.

Copy link
Member

Choose a reason for hiding this comment

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

We can probably fallback to Spark when offset > 0?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea, we need to do fallback for offset > 0.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. That's a minimal fix. However if we can access offset, we can implement the offset logic in comet as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Let me do fallback in this PR. I will address offset > 0 case in follow ups.

@viirya
Copy link
Member Author

viirya commented Feb 23, 2024

I was wondering why there is test failure as I didn't see it locally. But after rebased with main branch, I can reproduce it locally. Looking into which commit causes it...

@viirya
Copy link
Member Author

viirya commented Feb 23, 2024

Found the cause. We need CometTakeOrderedAndProjectExec listed in a pattern match list. Because we removed it from previous contributed patches, forgot to add it back.

Copy link
Member

@sunchao sunchao left a comment

Choose a reason for hiding this comment

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

LGTM

@viirya viirya merged commit ac3e0a7 into apache:main Feb 24, 2024
14 checks passed
@viirya
Copy link
Member Author

viirya commented Feb 24, 2024

Merged. Thanks.

@viirya viirya deleted the take_ordered branch February 24, 2024 18:05
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.

Add support of TakeOrderedAndProjectExec in Comet
3 participants