Skip to content

Integ match bool prefix #187#634

Merged
joshuali925 merged 41 commits intoopensearch-project:mainfrom
Bit-Quill:integ-match_bool_prefix-#187
Jun 27, 2022
Merged

Integ match bool prefix #187#634
joshuali925 merged 41 commits intoopensearch-project:mainfrom
Bit-Quill:integ-match_bool_prefix-#187

Conversation

@forestmvey
Copy link
Copy Markdown
Collaborator

Description

  1. Support match_bool_prefix in sql.
  2. Support match_bool_prefix in ppl.

Issues Resolved

Resolves: 187

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.

MaxKsyunz and others added 30 commits May 17, 2022 15:16
Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
Required renaming analyzeSyntax to parse.

Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
Added base class that is commont to match_query and match_bool_prefix and others.

Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
Thus completing update from upstream/main.

Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
Signed-off-by: forestmvey <forestv@bitquilltech.com>
Signed-off-by: forestmvey <forestv@bitquilltech.com>
Signed-off-by: forestmvey <forestv@bitquilltech.com>
Signed-off-by: forestmvey <forestv@bitquilltech.com>
Signed-off-by: forestmvey <forestv@bitquilltech.com>
Signed-off-by: forestmvey <forestv@bitquilltech.com>
Signed-off-by: forestmvey <forestv@bitquilltech.com>
IntelliJ's Cleanup considered these casts "redundant" and removed them.

This caused compilation to fail.

Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
Signed-off-by: forestmvey <forestv@bitquilltech.com>
Signed-off-by: forestmvey <forestv@bitquilltech.com>
Signed-off-by: forestmvey <forestv@bitquilltech.com>
match_bool_prefix merge dev branch 2#187
Signed-off-by: forestmvey <forestv@bitquilltech.com>
…function

Signed-off-by: forestmvey <forestv@bitquilltech.com>
MaxKsyunz and others added 2 commits June 16, 2022 19:08
Mention analyzer and operator optional parameters.

Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
…-params

Add analyzer and operator parameters to match_bool_prefix
@MaxKsyunz MaxKsyunz dismissed stale reviews from joshuali925 and dai-chen via 2d2ddf8 June 17, 2022 17:04
Yury-Fridlyand
Yury-Fridlyand previously approved these changes Jun 17, 2022
acarbonetto
acarbonetto previously approved these changes Jun 17, 2022
MaxKsyunz added 2 commits June 17, 2022 17:46
…efix-#187

# Conflicts:
#	core/src/main/java/org/opensearch/sql/expression/DSL.java
#	core/src/main/java/org/opensearch/sql/expression/function/OpenSearchFunctions.java
#	docs/user/dql/functions.rst
#	opensearch/src/main/java/org/opensearch/sql/opensearch/storage/script/filter/FilterQueryBuilder.java
#	ppl/src/main/antlr/OpenSearchPPLLexer.g4
#	sql/src/main/antlr/OpenSearchSQLParser.g4
Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
@MaxKsyunz MaxKsyunz dismissed stale reviews from acarbonetto and Yury-Fridlyand via eefa7e6 June 18, 2022 01:03
The method was renamed and compilation failed without this change.

Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 18, 2022

Codecov Report

Merging #634 (df48828) into main (90ccc3e) will decrease coverage by 31.91%.
The diff coverage is n/a.

@@              Coverage Diff              @@
##               main     #634       +/-   ##
=============================================
- Coverage     94.67%   62.76%   -31.92%     
=============================================
  Files           280       10      -270     
  Lines          7570      658     -6912     
  Branches        558      119      -439     
=============================================
- Hits           7167      413     -6754     
+ Misses          349      192      -157     
+ Partials         54       53        -1     
Flag Coverage Δ
query-workbench 62.76% <ø> (ø)
sql-engine ?

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

Impacted Files Coverage Δ
...c/main/java/org/opensearch/sql/expression/DSL.java
...h/sql/expression/function/BuiltinFunctionName.java
...h/sql/expression/function/OpenSearchFunctions.java
...arch/storage/script/filter/FilterQueryBuilder.java
...c/main/java/org/opensearch/sql/ppl/PPLService.java
.../org/opensearch/sql/ppl/antlr/PPLSyntaxParser.java
.../org/opensearch/sql/sql/antlr/SQLSyntaxParser.java
...ch/request/system/OpenSearchCatIndicesRequest.java
.../opensearch/sql/protocol/response/QueryResult.java
...l/opensearch/data/value/OpenSearchExprIpValue.java
... and 260 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 90ccc3e...df48828. Read the comment docs.

acarbonetto
acarbonetto previously approved these changes Jun 20, 2022
joshuali925
joshuali925 previously approved these changes Jun 21, 2022
Yury-Fridlyand
Yury-Fridlyand previously approved these changes Jun 22, 2022
Comment on lines +152 to +156
Limitations
>>>>>>>>>>>

The relevance functions are available to execute only in OpenSearch DSL but not in memory as of now, so the relevance search might fail for queries that are too complex to translate into DSL if the relevance function is following after a complex PPL query. To make your queries always work-able, it is recommended to place the relevance commands as close to the search command as possible, to ensure the relevance functions are eligible to push down. For example, a complex query like ``search source = people | rename firstname as name | dedup account_number | fields name, account_number, balance, employer | where match(employer, 'Open Search') | stats count() by city`` could fail because it is difficult to translate to DSL, but it would be better if we rewrite it to an equivalent query as ``search source = people | where match(employer, 'Open Search') | rename firstname as name | dedup account_number | fields name, account_number, balance, employer | stats count() by city`` by moving the where command with relevance function to the second command right after the search command, and the relevance would be optimized and executed smoothly in OpenSearch DSL. See `Optimization <../../optimization/optimization.rst>`_ to get more details about the query engine optimization. No newline at end of file
The relevance functions are available to execute only in OpenSearch DSL but not in memory as of now, so the relevance search might fail for queries that are too complex to translate into DSL if the relevance function is following after a complex PPL query. To make your queries always work-able, it is recommended to place the relevance commands as close to the search command as possible, to ensure the relevance functions are eligible to push down. For example, a complex query like ``search source = people | rename firstname as name | dedup account_number | fields name, account_number, balance, employer | where match(employer, 'Open Search') | stats count() by city`` could fail because it is difficult to translate to DSL, but it would be better if we rewrite it to an equivalent query as ``search source = people | where match(employer, 'Open Search') | rename firstname as name | dedup account_number | fields name, account_number, balance, employer | stats count() by city`` by moving the where command with relevance function to the second command right after the search command, and the relevance would be optimized and executed smoothly in OpenSearch DSL. See `Optimization <../../optimization/optimization.rst>`_ to get more details about the query engine optimization.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think that Limitations block should be last in the file.

…efix-#187

Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
MaxKsyunz added 2 commits June 23, 2022 13:52
Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
Copy link
Copy Markdown
Collaborator

@dai-chen dai-chen left a comment

Choose a reason for hiding this comment

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

Thanks for the changes!

@joshuali925 joshuali925 merged commit 86dcd51 into opensearch-project:main Jun 27, 2022
@MaxKsyunz MaxKsyunz deleted the integ-match_bool_prefix-#187 branch April 27, 2023 05:42
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.

Support match_bool_prefix function in SQL/PPL query engine

7 participants