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

Eliminate some typ() calls and an arity() call from MIR lowering #30879

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ggevay
Copy link
Contributor

@ggevay ggevay commented Dec 20, 2024

More typ() call elimination, similar to #30878

Also eliminates an arity call, since the arity can be seen from the type.

Motivation

  • This PR refactors existing code.

Tips for reviewer

Checklist

  • This PR has adequate test coverage / QA involvement has been duly considered. (trigger-ci for additional test/nightly runs)
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • If this PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way), then it is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration or tests, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).
  • If this PR includes major user-facing behavior changes, I have pinged the relevant PM to schedule a changelog post.

@ggevay ggevay added the A-CLUSTER Topics related to the CLUSTER layer label Dec 20, 2024
@ggevay ggevay requested a review from a team as a code owner December 20, 2024 10:43
@ggevay ggevay requested a review from mgree December 20, 2024 11:38
Copy link
Contributor

@mgree mgree left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@@ -778,7 +778,7 @@ This is not expected to cause incorrect results, but could indicate a performanc
.iter()
.any(|(key, _, _)| key == &required_arrangement.0)
{
types = Some(input.typ().column_types);
types = Some(types.unwrap_or_else(|| input.typ().column_types));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we could do slightly better, sometimes avoiding the arity() call, by doing the following at the top of the function:

let (plan, keys) = self.lower_mir_expr(input)?;
let arity = types.as_ref().map(|types| types.len()).unwrap_or_else(|| input.arity());
let (threshold_plan, required_arrangement) = ThresholdPlan::create_from(arity);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CLUSTER Topics related to the CLUSTER layer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants