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

Esql - rework date diff tests #120328

Merged
merged 5 commits into from
Jan 17, 2025

Conversation

not-napoleon
Copy link
Member

In preparation for adding nanosecond date support to date diff, this PR expands the test coverage and better integrates with the test generation framework. Using random data for date diff is extremely difficult, due to the vast range of units and the constraints of the integer return type. For example, nanosecond resolution differences of more than a couple of seconds will overflow the return value. So, instead of using a fully randomized dataset, I took the existing data set we were running against just the processing function, and formalized that to run against the whole test suite. It should be easy from here to add in cases for the same values as nanoseconds.

I was able to integrate the overflow error case into the normal test framework, but the incorrect unit error doesn't play nicely with the framework (I believe this is because it fails in toEvaluator rather than in process, but I didn't dig in much). I've moved it to another test file so we don't run it for every case in the parameterized test file.

@not-napoleon not-napoleon added >test Issues or PRs that are addressing/adding tests auto-backport Automatically create backport pull requests when merged :Analytics/ES|QL AKA ESQL v9.0.0 v8.18.0 labels Jan 16, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jan 16, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

@not-napoleon not-napoleon enabled auto-merge (squash) January 17, 2025 15:08
@not-napoleon not-napoleon merged commit f9ccb89 into elastic:main Jan 17, 2025
16 checks passed
not-napoleon added a commit to not-napoleon/elasticsearch that referenced this pull request Jan 17, 2025
In preparation for adding nanosecond date support to date diff, this PR expands the test coverage and better integrates with the test generation framework. Using random data for date diff is extremely difficult, due to the vast range of units and the constraints of the integer return type. For example, nanosecond resolution differences of more than a couple of seconds will overflow the return value. So, instead of using a fully randomized dataset, I took the existing data set we were running against just the processing function, and formalized that to run against the whole test suite. It should be easy from here to add in cases for the same values as nanoseconds.

I was able to integrate the overflow error case into the normal test framework, but the incorrect unit error doesn't play nicely with the framework (I believe this is because it fails in toEvaluator rather than in process, but I didn't dig in much). I've moved it to another test file so we don't run it for every case in the parameterized test file.

---------

Co-authored-by: elasticsearchmachine <[email protected]>
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL auto-backport Automatically create backport pull requests when merged Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) >test Issues or PRs that are addressing/adding tests v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants