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

CASSANDRA-20295 trunk fix min/max aggregation on reversed types #3872

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

Conversation

smiklosovic
Copy link
Contributor

Thanks for sending a pull request! Here are some tips if you're new here:

  • Ensure you have added or run the appropriate tests for your PR.
  • Be sure to keep the PR description updated to reflect all changes.
  • Write your PR title to summarize what this PR proposes.
  • If possible, provide a concise example to reproduce the issue for a faster review.
  • Read our contributor guidelines
  • If you're making a documentation change, see our guide to documentation contribution

Commit messages should follow the following format:

<One sentence description, usually Jira title or CHANGES.txt summary>

<Optional lengthier description (context on patch)>

patch by <Authors>; reviewed by <Reviewers> for CASSANDRA-#####

Co-authored-by: Name1 <email1>
Co-authored-by: Name2 <email2>

The Cassandra Jira

@smiklosovic smiklosovic force-pushed the CASSANDRA-20295-trunk branch 5 times, most recently from 5a6291b to 237eaba Compare February 5, 2025 21:16
@smiklosovic smiklosovic force-pushed the CASSANDRA-20295-trunk branch from 237eaba to 4458c6d Compare February 5, 2025 21:17
if (value == null)
return;

if (returnType.isReversed())
Copy link
Contributor

Choose a reason for hiding this comment

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

can you explain why this is needed vs returnType.unwrap()? If we are comparing we are just reversing the compare, so if we did returnType.unwrap() couldn't we avoid all this?

execute("INSERT INTO %s (a, b) VALUES (2, 100)");
execute("INSERT INTO %s (a, b) VALUES (4, 1)");

assertRows(execute("SELECT count(b), min(b) as max FROM %s"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
assertRows(execute("SELECT count(b), min(b) as max FROM %s"),
assertRows(execute("SELECT count(b), min(b) as min FROM %s"),

execute("INSERT INTO %s (a, b) VALUES (2, 100)");
execute("INSERT INTO %s (a, b) VALUES (4, 1)");

assertRows(execute("SELECT count(b), min(b) as max FROM %s"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
assertRows(execute("SELECT count(b), min(b) as max FROM %s"),
assertRows(execute("SELECT count(b), min(b) as min FROM %s"),

Copy link
Contributor

@dcapwell dcapwell left a comment

Choose a reason for hiding this comment

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

my main question is why the refactor doesn't do returnType.unwrap() and ignore all the complexity of reverse types. Im all for the refactor as i don't like copy/paste code, but the actual core part of the patch to address this I feel could be simplified, and mostly just wonder if there is a motivating reason to avoid .unwrap()?

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.

2 participants