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

min/max of decimal/interval depends on input order #4953

Open
xiangjinwu opened this issue Aug 29, 2022 · 1 comment
Open

min/max of decimal/interval depends on input order #4953

xiangjinwu opened this issue Aug 29, 2022 · 1 comment
Assignees

Comments

@xiangjinwu
Copy link
Contributor

xiangjinwu commented Aug 29, 2022

Describe the bug

Similar to #3873, it is debatable whether the minimum of 1.0 and 1.00 should be the former or latter. Do we also need to output the canonical value from the equivalent class so that it is agnostic of input order?

To Reproduce

create table t (v1 decimal, v2 interval);
create materialized view mv1 as select min(v1) as min1, min(v2) as min2, max(v1) as max1, max(v2) as max2 from t;

insert into t values (1.0, '30 day'), (1.00, '1 month');
select * from mv1;
select min(v1) as min1, min(v2) as min2, max(v1) as max1, max(v2) as max2 from t;

delete from t where v1 = 1;
insert into t values (1.00, '1 month'), (1.0, '30 day');
select * from mv1;
select min(v1) as min1, min(v2) as min2, max(v1) as max1, max(v2) as max2 from t;

Expected behavior

Open to discuss. Possible behaviors:

  • First value win / last value win (current and PostgreSQL)
  • Canonical value from the equivalent class
  • order by

Additional context

No response

@xiangjinwu xiangjinwu added the type/bug Something isn't working label Aug 29, 2022
@fuyufjh fuyufjh added this to the release-0.1.13 milestone Aug 31, 2022
@xiangjinwu xiangjinwu self-assigned this Sep 5, 2022
@xiangjinwu
Copy link
Contributor Author

This is just one of the indeterminism sources. No immediate fix needed. Keeping it open for more time so that we can summarize our decision regarding such cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants