Skip to content

[ESQL] Small refactoring of AggregateMapper#110841

Closed
not-napoleon wants to merge 1 commit intoelastic:mainfrom
not-napoleon:esql-small-refactoring-aggregate-mapper
Closed

[ESQL] Small refactoring of AggregateMapper#110841
not-napoleon wants to merge 1 commit intoelastic:mainfrom
not-napoleon:esql-small-refactoring-aggregate-mapper

Conversation

@not-napoleon
Copy link
Copy Markdown
Member

AggregateMapper#dataTypeToString returns a mapping from data types to strings. I moved that onto the data type itself, so it's easier to spot when adding new data types.

@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jul 12, 2024
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
Contributor

@ChrisHegarty ChrisHegarty left a comment

Choose a reason for hiding this comment

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

LGTM . Thanks @not-napoleon

@not-napoleon
Copy link
Copy Markdown
Member Author

I'm going to close this for now. We've had some recent discussions on a more broad refactoring of AggregateMapper, and I'd like to leave doing this until after that happens.

not-napoleon added a commit that referenced this pull request Oct 24, 2024
Resolves #110002
Resolves #110003
Resolves #110005

Enable Values, Count, CountDistinct, Min and Max aggregations on date nanos. In the course of addressing this, I had to make some changes to AggregateMapper where it maps types into string names. I tried to refactor this once before (#110841) but at the time we decided not to go ahead with it. That bit me while working on this, and so I am trying again to refactor it. This time I've made a more localized change, just replacing the cascading if block with a switch. That will cause a compile time failure when future new data types are added, unless they correctly update this section.

I've also done a small refactoring on the aggregators themselves, to make the supplier function consistent with the typeResolution.


---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
davidkyle pushed a commit to davidkyle/elasticsearch that referenced this pull request Oct 24, 2024
Resolves elastic#110002
Resolves elastic#110003
Resolves elastic#110005

Enable Values, Count, CountDistinct, Min and Max aggregations on date nanos. In the course of addressing this, I had to make some changes to AggregateMapper where it maps types into string names. I tried to refactor this once before (elastic#110841) but at the time we decided not to go ahead with it. That bit me while working on this, and so I am trying again to refactor it. This time I've made a more localized change, just replacing the cascading if block with a switch. That will cause a compile time failure when future new data types are added, unless they correctly update this section.

I've also done a small refactoring on the aggregators themselves, to make the supplier function consistent with the typeResolution.


---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
not-napoleon added a commit to not-napoleon/elasticsearch that referenced this pull request Oct 24, 2024
Resolves elastic#110002
Resolves elastic#110003
Resolves elastic#110005

Enable Values, Count, CountDistinct, Min and Max aggregations on date nanos. In the course of addressing this, I had to make some changes to AggregateMapper where it maps types into string names. I tried to refactor this once before (elastic#110841) but at the time we decided not to go ahead with it. That bit me while working on this, and so I am trying again to refactor it. This time I've made a more localized change, just replacing the cascading if block with a switch. That will cause a compile time failure when future new data types are added, unless they correctly update this section.

I've also done a small refactoring on the aggregators themselves, to make the supplier function consistent with the typeResolution.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
elasticsearchmachine pushed a commit that referenced this pull request Oct 24, 2024
…115558)

* [ESQL] Enable "any type" aggregations on Date Nanos (#114438)

Resolves #110002
Resolves #110003
Resolves #110005

Enable Values, Count, CountDistinct, Min and Max aggregations on date nanos. In the course of addressing this, I had to make some changes to AggregateMapper where it maps types into string names. I tried to refactor this once before (#110841) but at the time we decided not to go ahead with it. That bit me while working on this, and so I am trying again to refactor it. This time I've made a more localized change, just replacing the cascading if block with a switch. That will cause a compile time failure when future new data types are added, unless they correctly update this section.

I've also done a small refactoring on the aggregators themselves, to make the supplier function consistent with the typeResolution.

---------

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

* not sure how that happened

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
georgewallace pushed a commit to georgewallace/elasticsearch that referenced this pull request Oct 25, 2024
Resolves elastic#110002
Resolves elastic#110003
Resolves elastic#110005

Enable Values, Count, CountDistinct, Min and Max aggregations on date nanos. In the course of addressing this, I had to make some changes to AggregateMapper where it maps types into string names. I tried to refactor this once before (elastic#110841) but at the time we decided not to go ahead with it. That bit me while working on this, and so I am trying again to refactor it. This time I've made a more localized change, just replacing the cascading if block with a switch. That will cause a compile time failure when future new data types are added, unless they correctly update this section.

I've also done a small refactoring on the aggregators themselves, to make the supplier function consistent with the typeResolution.


---------

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

Enable Values, Count, CountDistinct, Min and Max aggregations on date nanos. In the course of addressing this, I had to make some changes to AggregateMapper where it maps types into string names. I tried to refactor this once before (elastic#110841) but at the time we decided not to go ahead with it. That bit me while working on this, and so I am trying again to refactor it. This time I've made a more localized change, just replacing the cascading if block with a switch. That will cause a compile time failure when future new data types are added, unless they correctly update this section.

I've also done a small refactoring on the aggregators themselves, to make the supplier function consistent with the typeResolution.


---------

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 >non-issue Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants