-
Notifications
You must be signed in to change notification settings - Fork 148
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
Correctly Set query status #2227
Conversation
Previously, the query status was set to SUCCESS only when the EMR-S job status was 'SUCCESS'. However, for index queries, even when the EMR Job Run State is 'RUNNING', the result should indicate success. This PR addresses and resolves this inconsistency. Tests done: * Manual verification: Created a skipping index and confirmed the async query result is marked 'successful' instead of 'running'. * Updated relevant unit tests. Signed-off-by: Kaituo Li <kaituo@amazon.com>
Codecov Report
@@ Coverage Diff @@
## main #2227 +/- ##
=========================================
Coverage 96.36% 96.36%
+ Complexity 4727 4726 -1
=========================================
Files 439 439
Lines 12686 12688 +2
Branches 872 871 -1
=========================================
+ Hits 12225 12227 +2
Misses 452 452
Partials 9 9
Flags with carried forward coverage won't be shown. Click here to find out more.
|
try { | ||
searchResponseActionFuture = client.search(searchRequest); | ||
} catch (Exception e) { | ||
// if there is no result index (e.g., EMR-S hasn't created the index yet), we return empty | ||
// json | ||
if (e instanceof IndexNotFoundException) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we could catch IndexNotFoundException?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably build is failing because we are missing unit tests for this piece of code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vamsi-amazon yeah, adding one now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@penghuo good catch. changed.
result.put(STATUS_FIELD, status); | ||
|
||
// If items have ERROR_FIELD, use it; otherwise, set empty string | ||
String error = items.optString(ERROR_FIELD, ""); | ||
result.put(ERROR_FIELD, error); | ||
} else { | ||
// make call to EMR Serverless when related result index documents are not available |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! it is help reduce query latency.
// That a job is running does not mean the status is running. For example, index/streaming Query | ||
// is a | ||
// long-running job which runs forever. But we need to return success from the result index | ||
// immediately. | ||
if (result.has(DATA_FIELD)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we check status
field? is it possible no data
filed in result?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as we discussed, we can assume status exist within data
if (result.has(DATA_FIELD)) { | ||
JSONObject items = result.getJSONObject(DATA_FIELD); | ||
|
||
// If items have STATUS_FIELD, use it; otherwise, use jobState | ||
String status = items.optString(STATUS_FIELD, jobState); | ||
String status = items.optString(STATUS_FIELD, JobRunState.FAILED.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in which case, result has data but does not has status field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
theoretically it is not possible. I provide a default here in case we get exception when it is not there.
Signed-off-by: Kaituo Li <kaituo@amazon.com>
@@ -14,10 +14,18 @@ S3Glue Connector | |||
Introduction | |||
============ | |||
|
|||
Properties in DataSource Configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be below introduction right. Can we move this to Glue Connector Properties in DataSource Configuration Section.
* Correctly Set query status Previously, the query status was set to SUCCESS only when the EMR-S job status was 'SUCCESS'. However, for index queries, even when the EMR Job Run State is 'RUNNING', the result should indicate success. This PR addresses and resolves this inconsistency. Tests done: * Manual verification: Created a skipping index and confirmed the async query result is marked 'successful' instead of 'running'. * Updated relevant unit tests. Signed-off-by: Kaituo Li <kaituo@amazon.com> * add unit test Signed-off-by: Kaituo Li <kaituo@amazon.com> --------- Signed-off-by: Kaituo Li <kaituo@amazon.com> (cherry picked from commit cd9d768) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Correctly Set query status Previously, the query status was set to SUCCESS only when the EMR-S job status was 'SUCCESS'. However, for index queries, even when the EMR Job Run State is 'RUNNING', the result should indicate success. This PR addresses and resolves this inconsistency. Tests done: * Manual verification: Created a skipping index and confirmed the async query result is marked 'successful' instead of 'running'. * Updated relevant unit tests. * add unit test --------- (cherry picked from commit cd9d768) Signed-off-by: Kaituo Li <kaituo@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Correctly Set query status Previously, the query status was set to SUCCESS only when the EMR-S job status was 'SUCCESS'. However, for index queries, even when the EMR Job Run State is 'RUNNING', the result should indicate success. This PR addresses and resolves this inconsistency. Tests done: * Manual verification: Created a skipping index and confirmed the async query result is marked 'successful' instead of 'running'. * Updated relevant unit tests. * add unit test --------- (cherry picked from commit cd9d768) Signed-off-by: Kaituo Li <kaituo@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> (cherry picked from commit 00ae8ce) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Correctly Set query status Previously, the query status was set to SUCCESS only when the EMR-S job status was 'SUCCESS'. However, for index queries, even when the EMR Job Run State is 'RUNNING', the result should indicate success. This PR addresses and resolves this inconsistency. Tests done: * Manual verification: Created a skipping index and confirmed the async query result is marked 'successful' instead of 'running'. * Updated relevant unit tests. * add unit test --------- (cherry picked from commit cd9d768) (cherry picked from commit 00ae8ce) Signed-off-by: Kaituo Li <kaituo@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
Previously, the query status was set to SUCCESS only when the EMR-S job status was 'SUCCESS'. However, for index queries, even when the EMR Job Run State is 'RUNNING', the result should indicate success. This PR addresses and resolves this inconsistency.
Tests done:
Issues Resolved
#2214
Check List
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.