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

Validate Field and Fields Parameters in Relevance Search Functions #1067

Conversation

forestmvey
Copy link
Collaborator

Description

Relevance functions that query fields should act similar to how a SELECT query works. If a field is queried that does not exist, a SemanticCheckException should be thrown.

Example Queryies

SELECT * FROM stackexchange_beer WHERE query_string([invalid], 'beer');

{'reason': 'Invalid SQL query', 'details': "can't resolve Symbol(namespace=FIELD_NAME, name=invalid) in type env", 'type': 'SemanticCheckException'}

SELECT * FROM stackexchange_beer WHERE match(invalid, 'beer');

{'reason': 'Invalid SQL query', 'details': "can't resolve Symbol(namespace=FIELD_NAME, name=invalid) in type env", 'type': 'SemanticCheckException'}

Issues Resolved

Issue: 613

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.

@forestmvey forestmvey requested a review from a team as a code owner November 10, 2022 23:05
@codecov-commenter
Copy link

codecov-commenter commented Nov 10, 2022

Codecov Report

Merging #1067 (8fa4d22) into 2.x (2af7321) will decrease coverage by 2.49%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##                2.x    #1067      +/-   ##
============================================
- Coverage     98.30%   95.81%   -2.50%     
- Complexity     3518     3530      +12     
============================================
  Files           342      352      +10     
  Lines          8694     9376     +682     
  Branches        554      679     +125     
============================================
+ Hits           8547     8984     +437     
- Misses          142      334     +192     
- Partials          5       58      +53     
Flag Coverage Δ
query-workbench 62.76% <ø> (?)
sql-engine 98.31% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...rg/opensearch/sql/analysis/ExpressionAnalyzer.java 100.00% <100.00%> (ø)
...h/sql/expression/function/OpenSearchFunctions.java 100.00% <100.00%> (ø)
workbench/public/components/app.tsx 0.00% <0.00%> (ø)
workbench/public/components/SQLPage/SQLPage.tsx 100.00% <0.00%> (ø)
...h/public/components/QueryLanguageSwitch/Switch.tsx 85.71% <0.00%> (ø)
workbench/public/components/PPLPage/PPLPage.tsx 56.52% <0.00%> (ø)
...ch/public/components/QueryResults/QueryResults.tsx 61.60% <0.00%> (ø)
...ublic/components/QueryResults/QueryResultsBody.tsx 68.32% <0.00%> (ø)
workbench/public/components/Header/Header.tsx 100.00% <0.00%> (ø)
workbench/public/utils/PanelWrapper.tsx 100.00% <0.00%> (ø)
... and 2 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

MaxKsyunz
MaxKsyunz previously approved these changes Nov 11, 2022
@dai-chen dai-chen added the bug Something isn't working label Nov 11, 2022
acarbonetto
acarbonetto previously approved these changes Nov 14, 2022
@forestmvey forestmvey force-pushed the integ-fix-permissive-relevance-fields branch 3 times, most recently from 9f5304c to a79dfcd Compare November 21, 2022 15:59
@acarbonetto
Copy link
Collaborator

@forestmvey can you make sure that we aren't reducing coverage with this PR?

@forestmvey forestmvey force-pushed the integ-fix-permissive-relevance-fields branch 3 times, most recently from 7e08c83 to 8fa4d22 Compare December 8, 2022 20:13
Signed-off-by: forestmvey <forestv@bitquilltech.com>
@forestmvey forestmvey changed the base branch from 2.x to main December 16, 2022 00:10
@forestmvey forestmvey force-pushed the integ-fix-permissive-relevance-fields branch from 8fa4d22 to f9aa20e Compare December 16, 2022 00:10
Copy link
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.

Thank you for the changes!

@MaxKsyunz MaxKsyunz merged commit d03c176 into opensearch-project:main Dec 20, 2022
opensearch-trigger-bot bot pushed a commit that referenced this pull request Dec 20, 2022
…1067)

Change relevance functions that query fields to throw a SemanticCheckException when a field is queried that does not exist.

Signed-off-by: forestmvey <forestv@bitquilltech.com>
(cherry picked from commit d03c176)
@MaxKsyunz MaxKsyunz deleted the integ-fix-permissive-relevance-fields branch December 20, 2022 19:35
penghuo pushed a commit that referenced this pull request Jan 3, 2023
…1067) (#1199)

Change relevance functions that query fields to throw a SemanticCheckException when a field is queried that does not exist.

Signed-off-by: forestmvey <forestv@bitquilltech.com>
(cherry picked from commit d03c176)

Co-authored-by: Forest Vey <36905077+forestmvey@users.noreply.github.com>
@forestmvey forestmvey restored the integ-fix-permissive-relevance-fields branch April 11, 2023 15:33
@forestmvey forestmvey deleted the integ-fix-permissive-relevance-fields branch April 11, 2023 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants