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


##########
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/ddl/HiveQueryDDLExecutor.java:
##########
@@ -77,27 +77,32 @@ public HiveQueryDDLExecutor(HiveSyncConfig config, 
IMetaStoreClient metaStoreCli
     this.metaStoreClient = metaStoreClient;
     this.driverPool = driverPool;
     this.metaStoreClientPool = metaStoreClientPool;
+    // SessionState.start() attaches the session it starts to this thread, 
displacing whatever the
+    // caller had there -- another executor's session, or that of an 
application embedding this
+    // sync. Ours is not the thread's to keep: every statement and the 
teardown bind it
+    // explicitly, so give the thread back once the Driver, whose constructor 
reads
+    // SessionState.get(), has been built.
+    SessionState previousSession = SessionState.get();
+    ClassLoader previousLoader = 
Thread.currentThread().getContextClassLoader();
     try {
-      this.sessionState = new SessionState(config.getHiveConf(),
+      // The session gets a conf of its own because it does not just read one: 
its constructor

Review Comment:
   Simplified



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