-
Notifications
You must be signed in to change notification settings - Fork 25k
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] Skip validating remote cluster index names in parser #114271
[ES|QL] Skip validating remote cluster index names in parser #114271
Conversation
…clusion unless the DateMath expression is invalid
Hi @fang-xing-esql, I've created a changelog YAML for you. |
Pinging @elastic/es-analytical-engine (Team:Analytics) |
Pinging @elastic/kibana-esql (ES|QL-ui) |
Not sure if that needs resolving: the grammar allows FROM with unquoted_index | quoted_index | unquoted_remote_cluster:(unquoted_index | quoted_index). So if smth is quoted only, that has to be an index. |
But will it not eventually fail anyways? In my understanding the point was to not allow later phases to execute, if we know it's for nothing. |
The story is more complex than this :-). I am in favor of skipping the validation of anything related to CCS. See this discussion for more context. Depending on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
for (String command : List.of("FROM", "METRICS")) { | ||
List<String> commands = new ArrayList<>(); | ||
commands.add("FROM"); | ||
if (Build.current().isSnapshot()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the tests run in non-snapshot code? Can stay as is, was just wondering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't have the assumeTrue
for snapshot, just be to cautious.
@@ -71,6 +75,9 @@ private static void validateIndexPattern(String indexPattern, EsqlBaseParser.Ind | |||
String[] indices = indexPattern.split(","); | |||
boolean hasExclusion = false; | |||
for (String index : indices) { | |||
if (isRemoteIndexName(index)) { // skip the validation if there is remote cluster |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is a bit baffling unless you dig in the grammar to understand that when quoting an index pattern, this can actually contain a remote index pattern, which is accepted downstream. I guess a comment (somewhere) would be nice to the next reader, but can also be merged as is without it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - please backport this to 8.16 also.
💔 Backport failedThe backport operation could not be completed due to the following error:
You can use sqren/backport to manually backport by running |
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
…#114271) * skip validating remote cluster index names in parser
…#114271) * skip validating remote cluster index names in parser
Resolves: #114201
Skip the validation of index names in parser if it is from a remote cluster.
Reduce the scope of #112081 to local indices only.
It is mainly because the behavior of invalid indices names on remote cluster is inconsistent with local cluster, for example these commands below pass even though the index name is invalid or remote cluster does not exists.
It is better to defer the validation of remote cluster indices names to later phase or until the pattern is clear.