Skip to content

Conversation

@costin
Copy link
Member

@costin costin commented Feb 7, 2020

Actual folding not yet in place.

Actual folding not yet in place
@costin costin added the :Analytics/EQL EQL querying label Feb 7, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/EQL)

@rw-access
Copy link
Contributor

does any of this make sense to put in QL? a lot looks like boilerplate and good candidates for QL, but that could just be because the actual folding isn't implemented yet

@costin
Copy link
Member Author

costin commented Feb 7, 2020

I was tempted to do that however the execution model between the SQL and EQL is likely to be different in the beginning. If it proves to remain similar, we can definitely move things in one place at least for some of nodes (like Filter and Limit).
An example is that the listener in SQL accepts a Page while in EQL for the time being is a Results (or whatever we end up calling it) and making that generic (inferring the generic type) might prove tricky and have a larger side-effect then copying some classes over...

Copy link
Contributor

@aleksmaus aleksmaus left a comment

Choose a reason for hiding this comment

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

few comments in few places maybe worth hardening against NPE?


@Override
public int hashCode() {
return executable.hashCode();
Copy link
Contributor

Choose a reason for hiding this comment

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

this would NPE if executable is null

Copy link
Member Author

Choose a reason for hiding this comment

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

The NPE cannot occur since:

  1. all children are non null as the plan is constructed.
  2. if by accident a null child is passed, the base class Node checks and throws a proper exception.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanation!

Copy link
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. Left one comment.

return failures.stream().map(f -> {
Location l = f.node().source().source();
return "line " + l.getLineNumber() + ":" + l.getColumnNumber() + ": " + f.message();
}).collect(Collectors.joining(StringUtils.NEW_LINE, "Found " + failures.size() + " problem(s)\n", StringUtils.EMPTY));
Copy link
Contributor

@astefan astefan Feb 9, 2020

Choose a reason for hiding this comment

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

I know it's code that already existed and you just moved it from one place to another, but I think we can do slightly better with the error message. Why not doing "Found " + failures.size() + " problem" + (failures.size() > 1 ? "s\n" : "\n")?

@costin costin merged commit d52b96f into elastic:master Feb 10, 2020
@costin costin deleted the eql/add-query-folder branch February 10, 2020 16:19
costin added a commit that referenced this pull request Feb 12, 2020
Actual folding not yet in place (TBD)

(cherry picked from commit d52b96f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/EQL EQL querying

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants