skywalker0618 commented on code in PR #19812:
URL: https://github.com/apache/hudi/pull/19812#discussion_r3918416479


##########
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/ddl/HiveQueryDDLExecutor.java:
##########
@@ -318,12 +316,34 @@ public void close() {
     if (metaStoreClient != null) {
       Hive.closeCurrent();
     }
-    if (hiveDriver != null) {
-      try {
-        hiveDriver.close();
-      } finally {
-        destroyQuietly(hiveDriver);
+    try {

Review Comment:
   Done, thanks!



##########
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/ddl/HiveQueryDDLExecutor.java:
##########
@@ -176,6 +169,11 @@ private List<CommandProcessorResponse> 
updateHiveSQLs(List<String> sqls) {
     List<CommandProcessorResponse> responses = new ArrayList<>();
     HoodieTimer timer = HoodieTimer.start();
     try {
+      // Driver.compile() resolves its session from a thread local that every 
executor on this
+      // thread writes: the one constructed most recently wins, and one that 
is closed clears it.
+      // Re-assert ours, as Hive documents a thread running several sessions 
must, so these
+      // statements run under the session that owns hiveDriver.
+      SessionState.setCurrentSessionState(sessionState);

Review Comment:
   Done as well



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

Reply via email to