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

KQL plugin - Code cleanup #116180

Merged
merged 6 commits into from
Nov 5, 2024
Merged

KQL plugin - Code cleanup #116180

merged 6 commits into from
Nov 5, 2024

Conversation

afoucret
Copy link
Contributor

@afoucret afoucret commented Nov 4, 2024

Few code cleanup for the KQL modules.

@elasticsearchmachine elasticsearchmachine added needs:triage Requires assignment of a team area label v9.0.0 labels Nov 4, 2024
@@ -0,0 +1,12 @@
module org.elasticsearch.kql {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

⚠️ using a module for KQL.

@@ -17,7 +17,7 @@ base {

dependencies {
compileOnly project(path: xpackModule('core'))
compileOnly "org.antlr:antlr4-runtime:${versions.antlr4}"
api "org.antlr:antlr4-runtime:${versions.antlr4}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

⚠️ Using api instead of compileOnly

Copy link
Member

Choose a reason for hiding this comment

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

Using api will expose this dependency to other modules. Is that needed? 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Got the same question

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Honestly, this is the same way other plugins using ANTLR runtime (lang-painless, ql, and esql-core) include it, so I didn’t think too much about it.

Using api probably makes sense for ql and esql-core since they’re extended, while implementation should work fine for kql and lang-painless

Sorry, I saw your comment only after I merged the PR but I can change api to implementation in a follow-up if you want.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

An even better patch would be to add the ANTLR runtime to libs. Maybe something for later.

@afoucret afoucret requested a review from a team November 4, 2024 14:53
@@ -211,15 +211,15 @@ private static boolean isEscapedKeywordSequence(String input, int startIndex) {
if (startIndex + 1 >= input.length()) {
return false;
}
String remaining = Strings.toRootLowerCase(input.substring(startIndex));
String remaining = input.substring(startIndex).toLowerCase(Locale.ROOT);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing a useless dependency to org.apache.logging.log4j.util.Strings

@afoucret afoucret added :Search/Search Search-related issues that do not fall into other categories auto-backport Automatically create backport pull requests when merged Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch labels Nov 4, 2024
@elasticsearchmachine elasticsearchmachine added Team:Search Meta label for search team and removed needs:triage Requires assignment of a team area label Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch labels Nov 4, 2024
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

Hi @afoucret, I've created a changelog YAML for you.

@afoucret afoucret changed the title KQL plugin KQL plugin - Code cleanup Nov 4, 2024
Copy link
Member

@kderusso kderusso left a comment

Choose a reason for hiding this comment

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

LGTM

@afoucret afoucret merged commit b13313f into elastic:main Nov 5, 2024
16 checks passed
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.x

afoucret added a commit to afoucret/elasticsearch that referenced this pull request Nov 5, 2024
jozala pushed a commit that referenced this pull request Nov 13, 2024
alexey-ivanov-es pushed a commit to alexey-ivanov-es/elasticsearch that referenced this pull request Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged >non-issue :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team v8.17.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants