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 metadata fields (_id) to be used as QualifiedName #141

Closed

Conversation

acarbonetto
Copy link

Description

OpenSearch reserved fields (_id, _score, _index, etc) are not allowed to be used in SQL clauses (SELECT, WHERE, ORDER BY) because the field format starting with underscore _ is not allowed.

This ticket adds specific identifiers to the language, and opens up support for OpenSearch reserved identifiers.

As an aside, identifiers with double underscore at the start (such as __myCoolField) is acceptable as a indentifier.

Example:
SELECT calcs.key, str0, _id, _score, _maxscore FROM calcs WHERE _id="5"

Result:
{ "key04", "OFFICE SUPPLIES", "5", null, null }

Issues Resolved

#639

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 Oct 24, 2022

Codecov Report

Merging #141 (c13c5fa) into integ-poc-metadata-fields (bfad32c) will decrease coverage by 35.19%.
The diff coverage is n/a.

@@                       Coverage Diff                        @@
##             integ-poc-metadata-fields     #141       +/-   ##
================================================================
- Coverage                        97.95%   62.76%   -35.20%     
================================================================
  Files                              303       10      -293     
  Lines                             7783      658     -7125     
  Branches                           501      119      -382     
================================================================
- Hits                              7624      413     -7211     
- Misses                             158      192       +34     
- Partials                             1       53       +52     
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 Δ
...ain/java/org/opensearch/sql/analysis/Analyzer.java
...request/system/OpenSearchDescribeIndexRequest.java
...ch/sql/opensearch/response/OpenSearchResponse.java
...pensearch/sql/sql/parser/AstExpressionBuilder.java
...ql/opensearch/storage/OpenSearchStorageEngine.java
...ript/aggregation/dsl/AggregationBuilderHelper.java
...nsearch/sql/planner/physical/RareTopNOperator.java
...ch/sql/data/utils/NullsFirstExprValueOrdering.java
.../filter/lucene/relevance/MatchBoolPrefixQuery.java
...ch/planner/logical/rule/MergeLimitAndRelation.java
... and 303 more

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

Signed-off-by: Andrew Carbonetto <[email protected]>
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.

1 participant