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

[ES|QL] use getExpressionType in more places #197695

Open
drewdaemon opened this issue Oct 24, 2024 · 3 comments
Open

[ES|QL] use getExpressionType in more places #197695

drewdaemon opened this issue Oct 24, 2024 · 3 comments
Labels
Feature:ES|QL ES|QL related features in Kibana impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:ESQL ES|QL related features in Kibana technical debt Improvement of the software architecture and operational architecture

Comments

@drewdaemon
Copy link
Contributor

Describe the feature:

#195989 added a utility getExpressionType to determine the type of an expression. It has the potential to replace / be merged with similar routines in our validation/autocomplete code.

  • extractTypeFromESNode — looks like a 1:1 substitution
  • checkFunctionArgMatchesDefinition — pretty close to a 1:1 substitution: get the type from the AST using getExpressionType and then check it against the parameter definition.
  • validateFunction — The function validation routine performs essentially the same traversal as getExpressionType while also generating error messages. Another difference is that validateFunction does checks on the way down, while getExpressionType computes the types on the way back up. Combining them could be great, but it is a stretch goal and I'm not absolutely certain it is the right thing to do.
@drewdaemon drewdaemon added Feature:ES|QL ES|QL related features in Kibana impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:ESQL ES|QL related features in Kibana technical debt Improvement of the software architecture and operational architecture labels Oct 24, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-esql (Team:ESQL)

@stratoula
Copy link
Contributor

stratoula commented Oct 25, 2024

@drewdaemon can you give me a size estimation for this task?

@drewdaemon
Copy link
Contributor Author

extractTypeFromESNode — looks like a 1:1 substitution
checkFunctionArgMatchesDefinition — pretty close to a 1:1 substitution: get the type from the AST using getExpressionType and then check it against the parameter definition.

^^ 2-3 days

validateFunction — The function validation routine performs essentially the same traversal as getExpressionType while also generating error messages. Another difference is that validateFunction does checks on the way down, while getExpressionType computes the types on the way back up. Combining them could be great, but it is a stretch goal and I'm not absolutely certain it is the right thing to do.

^^ not sure, more of an experiment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:ES|QL ES|QL related features in Kibana impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:ESQL ES|QL related features in Kibana technical debt Improvement of the software architecture and operational architecture
Projects
None yet
Development

No branches or pull requests

3 participants