Skip to content

[ESQL] Fix Binary Comparisons on Date Nanos#116346

Merged
not-napoleon merged 2 commits intoelastic:mainfrom
not-napoleon:esql-fix-date-nanos-binary-comparisons-2
Nov 7, 2024
Merged

[ESQL] Fix Binary Comparisons on Date Nanos#116346
not-napoleon merged 2 commits intoelastic:mainfrom
not-napoleon:esql-fix-date-nanos-binary-comparisons-2

Conversation

@not-napoleon
Copy link
Copy Markdown
Member

Relates to #109992

When I implemented binary comparisons for date nanos in #111908 I failed to update the verifyBinaryComparisons rule, which implements another layer of type checking for binary comparisons, external to the type logic in the Expression classes. Since the unit tests for the expressions don't run the full query processing stack, this bug was invisible to them. Only full integration tests, such as the CSV tests I've added here, can catch this kind of error. The initial PR did not include these because we didn't have enough supporting functions (notably TO_DATE_NANOS) to write the tests.

This PR fixes the issue by adding DATE_NANOS to the list of allowed types for binary comparisons in the verifier.

@not-napoleon not-napoleon added >bug auto-backport Automatically create backport pull requests when merged :Analytics/ES|QL AKA ESQL v9.0.0 v8.17.0 labels Nov 6, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Nov 6, 2024
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

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

@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Hi @not-napoleon, I've created a changelog YAML for you.

Copy link
Copy Markdown
Contributor

@bpintea bpintea left a comment

Choose a reason for hiding this comment

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

Lgtm

required_capability: to_date_nanos
required_capability: date_nanos_binary_comparison

FROM date_nanos | WHERE MV_MIN(nanos) > TO_DATE_NANOS("2023-10-23T12:27:28.948000000Z") | SORT nanos DESC;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nitty nit -- we can leave the 0s out

Suggested change
FROM date_nanos | WHERE MV_MIN(nanos) > TO_DATE_NANOS("2023-10-23T12:27:28.948000000Z") | SORT nanos DESC;
FROM date_nanos | WHERE MV_MIN(nanos) > TO_DATE_NANOS("2023-10-23T12:27:28.948Z") | SORT nanos DESC;

@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

💚 Backport successful

Status Branch Result
8.x

not-napoleon added a commit to not-napoleon/elasticsearch that referenced this pull request Nov 7, 2024
Relates to elastic#109992

When I implemented binary comparisons for date nanos in elastic#111908 I failed to update the verifyBinaryComparisons rule, which implements another layer of type checking for binary comparisons, external to the type logic in the Expression classes. Since the unit tests for the expressions don't run the full query processing stack, this bug was invisible to them. Only full integration tests, such as the CSV tests I've added here, can catch this kind of error. The initial PR did not include these because we didn't have enough supporting functions (notably TO_DATE_NANOS) to write the tests.

This PR fixes the issue by adding DATE_NANOS to the list of allowed types for binary comparisons in the verifier.
elasticsearchmachine pushed a commit that referenced this pull request Nov 7, 2024
Relates to #109992

When I implemented binary comparisons for date nanos in #111908 I failed to update the verifyBinaryComparisons rule, which implements another layer of type checking for binary comparisons, external to the type logic in the Expression classes. Since the unit tests for the expressions don't run the full query processing stack, this bug was invisible to them. Only full integration tests, such as the CSV tests I've added here, can catch this kind of error. The initial PR did not include these because we didn't have enough supporting functions (notably TO_DATE_NANOS) to write the tests.

This PR fixes the issue by adding DATE_NANOS to the list of allowed types for binary comparisons in the verifier.
kderusso pushed a commit to kderusso/elasticsearch that referenced this pull request Nov 7, 2024
Relates to elastic#109992

When I implemented binary comparisons for date nanos in elastic#111908 I failed to update the verifyBinaryComparisons rule, which implements another layer of type checking for binary comparisons, external to the type logic in the Expression classes. Since the unit tests for the expressions don't run the full query processing stack, this bug was invisible to them. Only full integration tests, such as the CSV tests I've added here, can catch this kind of error. The initial PR did not include these because we didn't have enough supporting functions (notably TO_DATE_NANOS) to write the tests.

This PR fixes the issue by adding DATE_NANOS to the list of allowed types for binary comparisons in the verifier.
jozala pushed a commit that referenced this pull request Nov 13, 2024
Relates to #109992

When I implemented binary comparisons for date nanos in #111908 I failed to update the verifyBinaryComparisons rule, which implements another layer of type checking for binary comparisons, external to the type logic in the Expression classes. Since the unit tests for the expressions don't run the full query processing stack, this bug was invisible to them. Only full integration tests, such as the CSV tests I've added here, can catch this kind of error. The initial PR did not include these because we didn't have enough supporting functions (notably TO_DATE_NANOS) to write the tests.

This PR fixes the issue by adding DATE_NANOS to the list of allowed types for binary comparisons in the verifier.
alexey-ivanov-es pushed a commit to alexey-ivanov-es/elasticsearch that referenced this pull request Nov 28, 2024
Relates to elastic#109992

When I implemented binary comparisons for date nanos in elastic#111908 I failed to update the verifyBinaryComparisons rule, which implements another layer of type checking for binary comparisons, external to the type logic in the Expression classes. Since the unit tests for the expressions don't run the full query processing stack, this bug was invisible to them. Only full integration tests, such as the CSV tests I've added here, can catch this kind of error. The initial PR did not include these because we didn't have enough supporting functions (notably TO_DATE_NANOS) to write the tests.

This PR fixes the issue by adding DATE_NANOS to the list of allowed types for binary comparisons in the verifier.
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 >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.17.0 v9.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants