Skip to content

[ESQL] test date nanos union type#116265

Merged
not-napoleon merged 9 commits intoelastic:mainfrom
not-napoleon:esql-test-date-nanos-union-type
Nov 11, 2024
Merged

[ESQL] test date nanos union type#116265
not-napoleon merged 9 commits intoelastic:mainfrom
not-napoleon:esql-test-date-nanos-union-type

Conversation

@not-napoleon
Copy link
Copy Markdown
Member

Resolves #112885

This PR adds a bunch of basic testing for using TO_DATE_NANOS as a union type. It also tests the TO_DATETIME union type for casting date nanos. There are still some cases that aren't covered here, mostly because we haven't finished adding date nanos support to all the relevant functions. I expect we'll add in those cases as we add functions support.

@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.17.0 labels Nov 5, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Nov 5, 2024
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

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

@not-napoleon
Copy link
Copy Markdown
Member Author

So I discovered a bunch of these tests weren't running locally. I've fixed most of them, but there's still one failing for me that requires deeper investigation.

@not-napoleon
Copy link
Copy Markdown
Member Author

The remaining test failure is due to #116346, I think.

@not-napoleon
Copy link
Copy Markdown
Member Author

Should be fixed now. Let's see what CI thinks.

Copy link
Copy Markdown
Contributor

@astefan astefan left a comment

Choose a reason for hiding this comment

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

LGTM with one comment.

;

@timestamp:date_nanos | client_ip:ip | event_duration:long | message:keyword
2023-10-23T13:55:01.543Z | 172.21.3.15 | 1756467 | Connected to 10.1.0.1
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.

I was expecting here a bunch if zeros after the decimal dot.
I see them here and it seems right.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This happens because the date nanos expected values parsing uses the ISO_DATE_WITH_NANOS saved format, which specifies .appendFraction(NANO_OF_SECOND, 3, 9, true). The 3, 9 there specifies a minimum "width" (i.e. number of digits) of 3 and a maximum of 9, so either format would be acceptable.

That said, it's easy enough to add in the zeros, I'll push that up in a moment. While I was looking at it, I noticed that when I wrote the value parsing logic, I missed an opportunity to use the library function for it, so I've replaced my math with that. This gets us a little extra error checking for expected values.

@not-napoleon
Copy link
Copy Markdown
Member Author

@elasticmachine test this please

@not-napoleon
Copy link
Copy Markdown
Member Author

@elasticmachine update branch

@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 11, 2024
Resolves elastic#112885

This PR adds a bunch of basic testing for using TO_DATE_NANOS as a union type. It also tests the TO_DATETIME union type for casting date nanos. There are still some cases that aren't covered here, mostly because we haven't finished adding date nanos support to all the relevant functions. I expect we'll add in those cases as we add functions support.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
jozala pushed a commit that referenced this pull request Nov 13, 2024
Resolves #112885

This PR adds a bunch of basic testing for using TO_DATE_NANOS as a union type. It also tests the TO_DATETIME union type for casting date nanos. There are still some cases that aren't covered here, mostly because we haven't finished adding date nanos support to all the relevant functions. I expect we'll add in those cases as we add functions support.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
afoucret pushed a commit to afoucret/elasticsearch that referenced this pull request Nov 14, 2024
Resolves elastic#112885

This PR adds a bunch of basic testing for using TO_DATE_NANOS as a union type. It also tests the TO_DATETIME union type for casting date nanos. There are still some cases that aren't covered here, mostly because we haven't finished adding date nanos support to all the relevant functions. I expect we'll add in those cases as we add functions support.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
not-napoleon added a commit that referenced this pull request Nov 19, 2024
* [ESQL] test date nanos union type (#116265)

Resolves #112885

This PR adds a bunch of basic testing for using TO_DATE_NANOS as a union type. It also tests the TO_DATETIME union type for casting date nanos. There are still some cases that aren't covered here, mostly because we haven't finished adding date nanos support to all the relevant functions. I expect we'll add in those cases as we add functions support.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

* add capability check

* add capability check

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
alexey-ivanov-es pushed a commit to alexey-ivanov-es/elasticsearch that referenced this pull request Nov 28, 2024
Resolves elastic#112885

This PR adds a bunch of basic testing for using TO_DATE_NANOS as a union type. It also tests the TO_DATETIME union type for casting date nanos. There are still some cases that aren't covered here, mostly because we haven't finished adding date nanos support to all the relevant functions. I expect we'll add in those cases as we add functions support.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
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.17.0 v9.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ESQL] Testing for date nanos union type

4 participants