Skip to content

Mark ReductionPushdown and ReduceElision WMR-safe#18554

Merged
ggevay merged 1 commit into
MaterializeInc:mainfrom
ggevay:wmr-reduction-pushdown
Apr 6, 2023
Merged

Mark ReductionPushdown and ReduceElision WMR-safe#18554
ggevay merged 1 commit into
MaterializeInc:mainfrom
ggevay:wmr-reduction-pushdown

Conversation

@ggevay

@ggevay ggevay commented Apr 3, 2023

Copy link
Copy Markdown
Contributor

This just marks ReductionPushdown and ReduceElision to be WMR-safe, and adds slts for both.

Note that unique key inference is not very smart yet for WMR, which is affecting ReduceElision, as shown by the last test in reduce_elision.slt. I opened a separate issue for that, and will work on this next. But there are already some situations when both ReductionPushdown and ReduceElision kick in, so we can merge this PR in itself.

Motivation

  • This PR adds a known-desirable feature:
    • MaterializeInc/database-issues#5339,
    • MaterializeInc/database-issues#5340

Tips for reviewer

I suggest reviewing the test for pushdown before elision, because the elision tests are similar, but more complicated.

Checklist

  • This PR has adequate test coverage / QA involvement has been duly considered.
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • This PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way) and therefore is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).
  • This PR includes the following user-facing behavior changes:

@ggevay ggevay added A-optimization Area: query optimization and transformation A-compute Area: compute labels Apr 3, 2023
@ggevay ggevay requested review from a team and aalexandrov April 3, 2023 12:57
@aalexandrov

Copy link
Copy Markdown
Contributor

Tagging @MaterializeInc/qa for a review.

@aalexandrov aalexandrov requested a review from a team April 3, 2023 16:01
@philip-stoev

Copy link
Copy Markdown
Contributor

I will work on this today. Apologies for the delay.

@philip-stoev philip-stoev requested review from philip-stoev and removed request for a team April 5, 2023 06:12

@philip-stoev philip-stoev 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.

No wrong results or panics with WMR. The only plan changes are the removal of Distinct, which I guess is expected.

@ggevay

ggevay commented Apr 5, 2023

Copy link
Copy Markdown
Contributor Author

Great, thank you very much!

@aalexandrov aalexandrov 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.

LGTM!

Note that ReduceElision will get smarter once we add a fixpoint loop
into the `LetRec` case of the unique key inference.

Fixes #18170, #18171
@ggevay ggevay force-pushed the wmr-reduction-pushdown branch from 5338639 to 51dd430 Compare April 6, 2023 12:34
@ggevay ggevay enabled auto-merge (rebase) April 6, 2023 12:34
@ggevay ggevay merged commit c464ed6 into MaterializeInc:main Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compute Area: compute A-optimization Area: query optimization and transformation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants