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

Add SC-54468 min/max regression test cases: min/max cannot return a NULL result on a non-nullable attribute, even when appropriate #5282

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

Conversation

rroelke
Copy link
Contributor

@rroelke rroelke commented Sep 4, 2024

While playing with adding aggregate functions to tiledb-rs I observed that the min and max aggregate operations return 0 when the array is empty.

In SQL, the min and max aggregate functions are expected to return NULL when there are no non-NULL inputs. While we are not SQL, I do believe it is important to be compliant with this expectation:

  1. many users will be prepared with knowledge and expectations of SQL.
  2. the result of zero is not distinguishable from an actual result and this may mislead users into drawing incorrect conclusions.
  3. Zero may not even be a value in the array!

We should improve the behavior so that min/max functions can always return NULL. This PR adds regression tests demonstrating that we can't or don't do this..


TYPE: BUG
DESC: add regression test demonstrating problems with non-nullable min/max result

@rroelke rroelke force-pushed the rr/sc-54468-regression-test branch from 567b0eb to f6ffd29 Compare September 4, 2024 20:08
@ihnorton ihnorton requested a review from bekadavis9 October 9, 2024 17:26
Copy link
Contributor

@bekadavis9 bekadavis9 left a comment

Choose a reason for hiding this comment

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

LGTM

// Data
std::vector<uint64_t> x = {1, 2, 3, 4, 5, 6, 7, 8};
std::vector<uint64_t> atts = {10, 20, 30, 40, 50, 60, 70, 80};

Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: remove extra line

return std::make_pair(maybe_min, maybe_max);
}

bool array_exists(Context& ctx, const char* uri);
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to be unused

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