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 _routing to SQL includes list #277

Merged
merged 2 commits into from
Jun 21, 2023

Conversation

acarbonetto
Copy link

@acarbonetto acarbonetto commented Jun 16, 2023

Description

Add the _routing reserved word as a metafield accessible as an identifier from any opensearch index.

Example:

select _id, _index, _routing, int0 from calcs limit 5

Example response:

        [
            "1",
            "calcs",
            "[xoyIAOdqQsS74x2yKSgiEQ][calcs][0]",
            1
        ],

Issues Resolved

Partially resolves: sql#1478

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.

Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
@codecov
Copy link

codecov bot commented Jun 16, 2023

Codecov Report

Merging #277 (da1973f) into integ-metafields-routing (94d5479) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@                     Coverage Diff                     @@
##             integ-metafields-routing     #277   +/-   ##
===========================================================
  Coverage                       97.33%   97.34%           
- Complexity                       4408     4409    +1     
===========================================================
  Files                             388      388           
  Lines                           10938    10940    +2     
  Branches                          773      774    +1     
===========================================================
+ Hits                            10647    10649    +2     
  Misses                            284      284           
  Partials                            7        7           
Flag Coverage Δ
sql-engine 97.34% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...search/sql/opensearch/storage/OpenSearchIndex.java 100.00% <ø> (ø)
...ch/sql/opensearch/response/OpenSearchResponse.java 100.00% <100.00%> (ø)

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

@@ -99,6 +101,31 @@ public void testMetafieldIdentifierTest() throws IOException {
verifyDataRows(result, rows(30, id, index, 1.0, 1.0, -2));
}

@Test
public void testMetafieldIdentifierRoutingTest() throws IOException {
// create an index, but the contents doesn't matter

Choose a reason for hiding this comment

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

Suggested change
// create an index, but the contents doesn't matter
// create an index, but the contents don't matter

@@ -146,8 +145,10 @@ public Iterator<ExprValue> iterator() {
if (maxScore != null) {
builder.put(METADATA_FIELD_MAXSCORE, maxScore);
}
} else { // if (metaDataField.equals(METADATA_FIELD_SORT)) {
} else if (metaDataField.equals(METADATA_FIELD_SORT)) {

Choose a reason for hiding this comment

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

maybe: use switch - case?

@acarbonetto acarbonetto merged commit 396f21c into integ-metafields-routing Jun 21, 2023
@acarbonetto acarbonetto deleted the dev-metafields-routing branch June 21, 2023 06:54
matthewryanwells pushed a commit that referenced this pull request Jul 11, 2023
* Add _routing to SQL includes list

Signed-off-by: Andrew Carbonetto <[email protected]>

* Update IT index

Signed-off-by: Andrew Carbonetto <[email protected]>

* Update doctest

Signed-off-by: acarbonetto <[email protected]>

* Add WHERE clause IT tests

Signed-off-by: acarbonetto <[email protected]>

* Fix IT test

Signed-off-by: acarbonetto <[email protected]>

* Update documentation for _routing

Signed-off-by: acarbonetto <[email protected]>

---------

Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: acarbonetto <[email protected]>
MitchellGale pushed a commit that referenced this pull request Jul 11, 2023
* Add _routing to SQL includes list

Signed-off-by: Andrew Carbonetto <[email protected]>

* Update IT index

Signed-off-by: Andrew Carbonetto <[email protected]>

* Update doctest

Signed-off-by: acarbonetto <[email protected]>

* Add WHERE clause IT tests

Signed-off-by: acarbonetto <[email protected]>

* Fix IT test

Signed-off-by: acarbonetto <[email protected]>

* Update documentation for _routing

Signed-off-by: acarbonetto <[email protected]>

---------

Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: acarbonetto <[email protected]>
Signed-off-by: Mitchell Gale <[email protected]>
MitchellGale pushed a commit that referenced this pull request Jul 11, 2023
* Add _routing to SQL includes list

Signed-off-by: Andrew Carbonetto <[email protected]>

* Update IT index

Signed-off-by: Andrew Carbonetto <[email protected]>

* Update doctest

Signed-off-by: acarbonetto <[email protected]>

* Add WHERE clause IT tests

Signed-off-by: acarbonetto <[email protected]>

* Fix IT test

Signed-off-by: acarbonetto <[email protected]>

* Update documentation for _routing

Signed-off-by: acarbonetto <[email protected]>

---------

Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: acarbonetto <[email protected]>
Signed-off-by: Mitchell Gale <[email protected]>
MitchellGale pushed a commit that referenced this pull request Jul 12, 2023
…pensearch-project#1831)

* Add _routing to SQL includes list

Signed-off-by: Andrew Carbonetto <[email protected]>

* Update IT index

Signed-off-by: Andrew Carbonetto <[email protected]>

* Update doctest

Signed-off-by: acarbonetto <[email protected]>

* Add WHERE clause IT tests

Signed-off-by: acarbonetto <[email protected]>

* Fix IT test

Signed-off-by: acarbonetto <[email protected]>

* Update documentation for _routing

Signed-off-by: acarbonetto <[email protected]>

---------

Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: acarbonetto <[email protected]>
(cherry picked from commit 876a9c8)

Co-authored-by: Andrew Carbonetto <[email protected]>
MitchellGale pushed a commit that referenced this pull request Jul 20, 2023
* Add _routing to SQL includes list

Signed-off-by: Andrew Carbonetto <[email protected]>

* Update IT index

Signed-off-by: Andrew Carbonetto <[email protected]>

* Update doctest

Signed-off-by: acarbonetto <[email protected]>

* Add WHERE clause IT tests

Signed-off-by: acarbonetto <[email protected]>

* Fix IT test

Signed-off-by: acarbonetto <[email protected]>

* Update documentation for _routing

Signed-off-by: acarbonetto <[email protected]>

---------

Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: acarbonetto <[email protected]>
Signed-off-by: Mitchell Gale <[email protected]>
Yury-Fridlyand pushed a commit that referenced this pull request Aug 22, 2023
…pensearch-project#1843)

* Add _routing to SQL includes list

Signed-off-by: Andrew Carbonetto <[email protected]>

* Update IT index

Signed-off-by: Andrew Carbonetto <[email protected]>

* Update doctest

Signed-off-by: acarbonetto <[email protected]>

* Add WHERE clause IT tests

Signed-off-by: acarbonetto <[email protected]>

* Fix IT test

Signed-off-by: acarbonetto <[email protected]>

* Update documentation for _routing

Signed-off-by: acarbonetto <[email protected]>

---------

Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: acarbonetto <[email protected]>
(cherry picked from commit 876a9c8)

Co-authored-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.

6 participants