-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add support for wildcard_query function #156
Conversation
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
Codecov Report
@@ Coverage Diff @@
## integ-add-wildcardquery #156 +/- ##
=============================================================
- Coverage 98.29% 95.79% -2.51%
- Complexity 3465 3473 +8
=============================================================
Files 347 358 +11
Lines 8645 9322 +677
Branches 550 669 +119
=============================================================
+ Hits 8498 8930 +432
- Misses 142 334 +192
- Partials 5 58 +53
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
...java/org/opensearch/sql/opensearch/storage/script/filter/lucene/relevance/WildcardQuery.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
...java/org/opensearch/sql/opensearch/storage/script/filter/lucene/relevance/WildcardQuery.java
Outdated
Show resolved
Hide resolved
...rc/test/java/org/opensearch/sql/opensearch/storage/script/filter/FilterQueryBuilderTest.java
Show resolved
Hide resolved
.../test/java/org/opensearch/sql/opensearch/storage/script/filter/lucene/WildcardQueryTest.java
Outdated
Show resolved
Hide resolved
.../test/java/org/opensearch/sql/opensearch/storage/script/filter/lucene/WildcardQueryTest.java
Outdated
Show resolved
Hide resolved
.../test/java/org/opensearch/sql/opensearch/storage/script/filter/lucene/WildcardQueryTest.java
Outdated
Show resolved
Hide resolved
...earch/sql/opensearch/storage/script/filter/lucene/relevance/FunctionParameterRepository.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/opensearch/sql/expression/function/OpenSearchFunctionsTest.java
Outdated
Show resolved
Hide resolved
integ-test/src/test/java/org/opensearch/sql/ppl/WildcardQueryIT.java
Outdated
Show resolved
Hide resolved
integ-test/src/test/java/org/opensearch/sql/sql/WildcardQueryIT.java
Outdated
Show resolved
Hide resolved
integ-test/src/test/java/org/opensearch/sql/sql/WildcardQueryIT.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Guian Gumpac <[email protected]>
...earch/sql/opensearch/storage/script/filter/lucene/relevance/FunctionParameterRepository.java
Show resolved
Hide resolved
...java/org/opensearch/sql/opensearch/storage/script/filter/lucene/relevance/WildcardQuery.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
Please, fix failed integration tests. |
integ-test/src/test/java/org/opensearch/sql/sql/WildcardQueryIT.java
Outdated
Show resolved
Hide resolved
integ-test/src/test/java/org/opensearch/sql/sql/WildcardQueryIT.java
Outdated
Show resolved
Hide resolved
…arch-project-sql into dev-add-wildcardquery
Signed-off-by: Guian Gumpac <[email protected]>
...arch/src/main/java/org/opensearch/sql/opensearch/storage/script/filter/lucene/LikeQuery.java
Show resolved
Hide resolved
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
Can we look into fixing the coverage for this please? |
...arch/src/main/java/org/opensearch/sql/opensearch/storage/script/filter/lucene/LikeQuery.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
} | ||
|
||
@Test | ||
public void test_like_with_percent() throws IOException { |
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.
❤️ I like how you split tests by scenario.
@Override | ||
public QueryBuilder build(FunctionExpression func) { | ||
ReferenceExpression ref = (ReferenceExpression) func.getArguments().get(0); | ||
String field = convertTextToKeyword(ref.toString(), ref.type()); |
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.
I'd use ref.getAttr()
here instead of toString()
.
They happen to be the same in this case but toString()
can return anything.
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.
Thanks. Addressed in b54a934
} | ||
|
||
@Test | ||
public void test_escaping_sql_wildcards() { |
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.
A better home for this test is in the common/src/test/java/org.opensearch.sql.common.utils
-- in same module where the StringUtils.convertSqlWildcardToLucene
is defined.
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.
Thanks. Addressed in b54a934
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
…nsearch-project#1108) Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Naveen Tatikonda <[email protected]>
Description
Add support for
wildcard_query
function:wildcard_query
andwildcardquery
are supported in SQL.wildcard_query
is supported in PPL.*
and?
as per https://opensearch.org/docs/latest/opensearch/query-dsl/term/#wildcards%
to*
and_
to?
is supported as per the legacy implementation.Issues Resolved
opensearch-project#1032
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.