architjainjain commented on code in PR #6501:
URL: https://github.com/apache/hive/pull/6501#discussion_r3729728724


##########
service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java:
##########
@@ -813,14 +813,27 @@ public TGetOperationStatusResp 
GetOperationStatus(TGetOperationStatusReq req) th
       }
       TJobExecutionStatus executionStatus =
           mapper.forStatus(progressUpdate.status);
-      resp.setProgressUpdateResponse(new TProgressUpdateResp(
+      TProgressUpdateResp tProgressUpdateResp = new TProgressUpdateResp(
           progressUpdate.headers(),
           progressUpdate.rows(),
           progressUpdate.progressedPercentage,
           executionStatus,
           progressUpdate.footerSummary,
           progressUpdate.startTimeMillis
-      ));
+      );
+      // HIVE-27126: Workaround for Thrift code generation bug.
+      // When queueMetrics field was added and Thrift code regenerated, the 
generated constructor
+      // accepts startTimeMillis parameter but FAILS to call 
setStartTimeIsSet(true).
+      // Without the isset flag, Thrift serialization treats startTime as 
unset, causing:
+      // 1) Clients receive incomplete/invalid progress updates
+      // 2) Thrift validation may fail or skip the field entirely
+      // Solution: Explicitly call setStartTime() after construction to set 
the isset flag.
+      // This ensures proper serialization and backward compatibility with 
Thrift clients.
+      tProgressUpdateResp.setStartTime(progressUpdate.startTimeMillis);
+      if (progressUpdate.queueMetrics() != null && 
!progressUpdate.queueMetrics().isEmpty()) {
+        tProgressUpdateResp.setQueueMetrics(progressUpdate.queueMetrics());
+      }
+      resp.setProgressUpdateResponse(tProgressUpdateResp);

Review Comment:
   @abstractdog Thanks for the suggestions, This is fixed.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to