generated from amazon-archives/__template_Custom
-
Notifications
You must be signed in to change notification settings - Fork 180
Pass JOIN_TIME_OUT value to keepalive #3826
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
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
8624ebf
Fix JOIN_TIME_OUT
ahkcs 162630d
fix style
ahkcs 2730ab3
fix
ahkcs 38243e1
fix CI
ahkcs 540e9de
fix
ahkcs 72a9ccf
fixes
ahkcs 6a69453
fixes
ahkcs a516c8f
fix log-rethrow
ahkcs 8908600
Restructure
ahkcs db25f65
fix CI
ahkcs 4b2afdd
fix format
ahkcs ca1f7f2
remove unused PIT
ahkcs 03c1d54
remove reflection, add hintConfig
ahkcs 9e7f046
Added Unit test, restructured to use existing methods
ahkcs e7a5f1a
fixes
ahkcs d7a14c1
fix
ahkcs b25a4d0
fixes
ahkcs e12d074
add IT tests
ahkcs 51ad4db
formatting
ahkcs 45227ac
Trim IT
ahkcs eb0a86e
format fix
ahkcs 5e6c2e8
trim IT
ahkcs 83cee53
formatting
ahkcs 537ba3a
Merge branch 'main' into roche-pit
ahkcs 8dd78f1
Update legacy/src/main/java/org/opensearch/sql/legacy/query/planner/p…
ahkcs 3583202
fix
ahkcs 7ea4c84
Merge branch 'main' into roche-pit
ahkcs 1dbc823
update .gitignore
ahkcs e46e4ae
deletion
ahkcs f928f3c
restore main PIT
ahkcs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
integ-test/src/test/java/org/opensearch/sql/legacy/JoinTimeoutHintIT.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| /* | ||
| * Copyright OpenSearch Contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package org.opensearch.sql.legacy; | ||
|
|
||
| import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_DOG; | ||
| import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_PEOPLE; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.Locale; | ||
| import org.json.JSONArray; | ||
| import org.json.JSONObject; | ||
| import org.junit.Test; | ||
|
|
||
| /** Integration tests for JOIN_TIME_OUT hint functionality. */ | ||
| public class JoinTimeoutHintIT extends SQLIntegTestCase { | ||
|
|
||
| @Override | ||
| protected void init() throws Exception { | ||
| loadIndex(Index.DOG); | ||
| loadIndex(Index.PEOPLE); | ||
| loadIndex(Index.GAME_OF_THRONES); | ||
| } | ||
|
|
||
| /** | ||
| * Core integration test: Verify that JOIN_TIME_OUT hint prevents PIT expiration errors by setting | ||
| * PIT keepalive to match the hint value instead of default 60 seconds. | ||
| * | ||
| * <p>This is the primary test for the GitHub issue fix. | ||
| */ | ||
| @Test | ||
| public void testJoinTimeoutHintPreventsPointInTimeExpiration() throws IOException { | ||
| String query = | ||
| String.format( | ||
| Locale.ROOT, | ||
| "SELECT /*! JOIN_TIME_OUT(120) */ a.firstname, a.lastname, d.dog_name " | ||
| + "FROM %s a JOIN %s d ON d.holdersName = a.firstname " | ||
| + "WHERE a.age > 25 LIMIT 10", | ||
| TEST_INDEX_PEOPLE, | ||
| TEST_INDEX_DOG); | ||
|
|
||
| // The main test: this should execute without throwing "Point In Time id doesn't exist" error | ||
| JSONObject result = executeQuerySafely(query); | ||
| assertNotNull( | ||
| "Query with JOIN_TIME_OUT hint should execute without PIT expiration error", result); | ||
|
|
||
| int resultsCount = getResultsCount(result); | ||
| assertTrue("Should execute successfully", resultsCount >= 0); | ||
| assertTrue("Should respect LIMIT", resultsCount <= 10); | ||
| } | ||
|
|
||
| /** | ||
| * Regression test: Verify queries without JOIN_TIME_OUT hint still work to ensure implementation | ||
| * doesn't break existing functionality | ||
| */ | ||
| @Test | ||
| public void testJoinWithoutTimeoutHintStillWorks() throws IOException { | ||
| String query = | ||
| String.format( | ||
| Locale.ROOT, | ||
| "SELECT a.firstname, d.dog_name " | ||
| + "FROM %s a JOIN %s d ON d.holdersName = a.firstname " | ||
| + "WHERE a.age > 25 LIMIT 5", | ||
| TEST_INDEX_PEOPLE, | ||
| TEST_INDEX_DOG); | ||
|
|
||
| JSONObject result = executeQuerySafely(query); | ||
| assertNotNull("Query without JOIN_TIME_OUT hint should still work", result); | ||
|
|
||
| int resultsCount = getResultsCount(result); | ||
| assertTrue("Should work without timeout hint", resultsCount >= 0); | ||
| assertTrue("Should respect LIMIT", resultsCount <= 5); | ||
| } | ||
|
|
||
| private JSONObject executeQuerySafely(String query) throws IOException { | ||
| JSONObject result = executeQuery(query); | ||
|
|
||
| if (result.has("error")) { | ||
| throw new RuntimeException("Query failed: " + result.getJSONObject("error")); | ||
| } | ||
|
|
||
| return result; | ||
| } | ||
|
|
||
| private int getResultsCount(JSONObject result) { | ||
| // Check for SQL response format first | ||
| if (result.has("total")) { | ||
| return result.getInt("total"); | ||
| } | ||
|
|
||
| // Check for traditional OpenSearch hits format | ||
| if (result.has("hits")) { | ||
| JSONArray hits = getHits(result); | ||
| return hits.length(); | ||
| } | ||
|
|
||
| // No results found | ||
| return 0; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.