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

Add support for wildcard_query function #156

Merged
merged 35 commits into from
Nov 25, 2022

Conversation

GumpacG
Copy link

@GumpacG GumpacG commented Nov 4, 2022

Description

Add support for wildcard_query function:

Issues Resolved

opensearch-project#1032

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

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.

@codecov
Copy link

codecov bot commented Nov 4, 2022

Codecov Report

Merging #156 (9da6140) into integ-add-wildcardquery (50669eb) will decrease coverage by 2.50%.
The diff coverage is 100.00%.

@@                      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     
Flag Coverage Δ
query-workbench 62.76% <ø> (?)
sql-engine 98.30% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...arch/storage/script/filter/FilterQueryBuilder.java 100.00% <ø> (ø)
...c/main/java/org/opensearch/sql/expression/DSL.java 100.00% <100.00%> (ø)
...h/sql/expression/function/BuiltinFunctionName.java 100.00% <100.00%> (ø)
...h/sql/expression/function/OpenSearchFunctions.java 100.00% <100.00%> (ø)
...search/storage/script/filter/lucene/LikeQuery.java 100.00% <100.00%> (ø)
.../lucene/relevance/FunctionParameterRepository.java 100.00% <100.00%> (ø)
.../script/filter/lucene/relevance/WildcardQuery.java 100.00% <100.00%> (ø)
...h/public/components/QueryLanguageSwitch/Switch.tsx 85.71% <0.00%> (ø)
workbench/public/components/Header/Header.tsx 100.00% <0.00%> (ø)
...ch/public/components/QueryResults/QueryResults.tsx 61.60% <0.00%> (ø)
... and 7 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Guian Gumpac added 4 commits November 7, 2022 15:04
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
@MaxKsyunz MaxKsyunz self-requested a review November 14, 2022 22:13
Guian Gumpac added 2 commits November 14, 2022 14:31
Signed-off-by: Guian Gumpac <[email protected]>
@Yury-Fridlyand
Copy link

Please, fix failed integration tests.

docs/user/dql/functions.rst Outdated Show resolved Hide resolved
docs/user/dql/functions.rst Outdated Show resolved Hide resolved
Guian Gumpac added 2 commits November 15, 2022 12:07
…arch-project-sql into dev-add-wildcardquery
Signed-off-by: Guian Gumpac <[email protected]>
@acarbonetto
Copy link

Can we look into fixing the coverage for this please?

Guian Gumpac added 3 commits November 24, 2022 14:46
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Guian Gumpac <[email protected]>
}

@Test
public void test_like_with_percent() throws IOException {

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());

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.

Copy link
Author

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() {

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.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks. Addressed in b54a934

Guian Gumpac added 2 commits November 25, 2022 08:29
Signed-off-by: Guian Gumpac <[email protected]>
@GumpacG GumpacG merged commit 2cd6921 into integ-add-wildcardquery Nov 25, 2022
@GumpacG GumpacG deleted the dev-add-wildcardquery branch January 21, 2023 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants