-
Notifications
You must be signed in to change notification settings - Fork 170
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
Provide QueryStatus V2 API #1371
Conversation
If original issue is related to thread safety then why can't we fix it in existing API? Why we need a new V2 API? |
@sfc-gh-igarish the existing data structure is an enum, and the only option I see to make it thread-safe would be to use thread-local variables for |
Any public API signature changes is a breaking change as it used by existing users. Please think of making existing API thread safe. |
Another suggestion would be to add the new API without changing the existing API so that they both can co-exist without breaking backwards compatibility. Also @arouel you mentioned there are other reasons why this API cannot be thread safe, care to elaborate? |
@arouel Please check PR comments. |
@@ -153,7 +153,7 @@ public void addQueryToActiveQueryList(String queryID) { | |||
* @return enum of type QueryStatus indicating the query's status | |||
* @throws SQLException | |||
*/ | |||
public QueryStatus getQueryStatus(String queryID) throws SQLException { | |||
public JsonNode getQueryMetadata(String queryID) throws SQLException { |
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.
Do we need this as public?
* @return enum of type QueryStatus indicating the query's status | ||
* @throws SQLException | ||
*/ | ||
public QueryStatus getQueryStatus(String queryID) throws SQLException { |
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.
Definitely worth some deprecation comment now.
* @return an instance containing query metadata | ||
* @throws SQLException | ||
*/ | ||
QueryStatusV2 getQueryStatus() throws SQLException; |
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.
I'm wondering if we should name it consistently to existing function - getStatusV2
?
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.
Also why new function is not taking queryId as an argument?
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.
Because this is a function on resultSet - resultSet knows its queryId (even provides it by getQueryId).
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 is more about async execution. Are we providing resultset object before completed the query?
@@ -153,7 +153,7 @@ public void addQueryToActiveQueryList(String queryID) { | |||
* @return enum of type QueryStatus indicating the query's status |
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 information is not accurate anymore?
Implemented in #1579 |
Overview
What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes The
errorCode
anderrorMessage
fields ofQueryStatus
enum are not thread-safe #1370Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
QueryStatusV2
to keep the behavior of theQueryStatus
enum for backwards compatibility.SnowflakeResultSet
calledgetQueryStatus
which return aQueryStatusV2
.SFAsyncResultSet
, andSnowflakeResultSetV1
throws aSnowflakeLoggedFeatureNotSupportedException
.SFSession
calledgetQueryStatusV2
which return aQueryStatusV2
.Pre-review checklist