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] repalce string switch with enum switch #110036

Merged

Conversation

not-napoleon
Copy link
Member

Now that data types are an enum, we can just switch on the objects themselves, rather than needing to use the string versions. This way, we can get a compile time error if we add a type and forget to account for it here.

Ideally, we'd move this to just be a field on the enum itself, but because DataType is still in core, we don't have the correct visibility. If we move it out of core, it might be worth revisiting this.

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

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

Copy link
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.

Is it just here that we use strings? Feels there should be a bunch more places.

@not-napoleon not-napoleon added the auto-merge Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Jun 21, 2024
@elasticsearchmachine elasticsearchmachine merged commit f24f9c4 into elastic:main Jun 21, 2024
15 checks passed
@not-napoleon not-napoleon deleted the esql-clean-up-type-switch branch June 21, 2024 13:04
elasticsearchmachine pushed a commit that referenced this pull request Jun 25, 2024
Similar to #110036, this
creates the opportunity for the compiler to flag this as a place which
needs to be changed when we add a data type.  It's also fewer lines of
code, and makes it explicit which types are not supported.

Ideally, this would also become a property on DataType, but that can't
happen until we pull it out of core.
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-merge Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) >non-issue Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants