hudi-agent commented on code in PR #19812:
URL: https://github.com/apache/hudi/pull/19812#discussion_r3937709418


##########
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:
   🤖 nit: these inline comments are quite dense (7+ lines of narrative prose 
here, similar blocks throughout). Could you tighten them to the key invariant — 
e.g. "session needs its own HiveConf copy so close() doesn't delete scratch 
dirs / close the loader shared with config's HiveConf" — and lean on the method 
Javadocs for the rest? It'd be easier for a future reader to skim.
   
   <sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



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