You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2019/05/16 05:55:40 UTC
[GitHub] [hive] maheshk114 commented on a change in pull request #629:
HIVE-21730: HiveStatement.getQueryId throws TProtocolException when
response is null.
maheshk114 commented on a change in pull request #629: HIVE-21730: HiveStatement.getQueryId throws TProtocolException when response is null.
URL: https://github.com/apache/hive/pull/629#discussion_r284547473
##########
File path: jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java
##########
@@ -1015,12 +1016,18 @@ public void setInPlaceUpdateStream(InPlaceUpdateStream stream) {
*/
@LimitedPrivate(value={"Hive and closely related projects."})
public String getQueryId() throws SQLException {
- if (stmtHandle == null) {
+ // Storing it in temp variable as this method is not thread-safe and concurrent thread can
+ // close this handle and set it to null after checking for null.
+ TOperationHandle stmtHandleTmp = stmtHandle;
+ if (stmtHandleTmp == null) {
// If query is not running or already closed.
return null;
}
try {
- return client.GetQueryId(new TGetQueryIdReq(stmtHandle)).getQueryId();
+ String queryId = client.GetQueryId(new TGetQueryIdReq(stmtHandleTmp)).getQueryId();
+
+ // Returns empty string if query was already closed.
Review comment:
comment say return empty string but its returning null
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org