yuzelin commented on code in PR #20887:
URL: https://github.com/apache/flink/pull/20887#discussion_r978214084


##########
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/endpoint/hive/HiveServer2Endpoint.java:
##########
@@ -296,22 +296,27 @@ public TOpenSessionResp OpenSession(TOpenSessionReq 
tOpenSessionReq) throws TExc
                     tOpenSessionReq.getConfiguration() == null
                             ? Collections.emptyMap()
                             : tOpenSessionReq.getConfiguration();
-            Map<String, String> sessionConfig = new HashMap<>();
-            sessionConfig.put(TABLE_SQL_DIALECT.key(), SqlDialect.HIVE.name());
-            sessionConfig.put(RUNTIME_MODE.key(), 
RuntimeExecutionMode.BATCH.name());
-            sessionConfig.put(TABLE_DML_SYNC.key(), "true");
-            HiveConf conf = HiveCatalog.createHiveConf(hiveConfPath, null);
-            // set variables to HiveConf or Session's conf
-            setVariables(conf, sessionConfig, originSessionConf);
 
+            HiveConf conf = new HiveConf(hiveConf);
             Catalog hiveCatalog =
                     new HiveCatalog(
                             catalogName,
                             
getUsedDefaultDatabase(originSessionConf).orElse(defaultDatabase),
                             conf,
                             HiveShimLoader.getHiveVersion(),
                             allowEmbedded);
+            // Trigger the creation of the HiveMetaStoreClient to use the same 
HiveConf. If the
+            // initial HiveConf is different, it will trigger the 
PersistenceManagerFactory to close
+            // all the alive PersistenceManager in the ObjectStore, which may 
get error like
+            // "PersistenceManager is closed" in the later connection.

Review Comment:
   The exact exception message is “Persistence Manager has been closed”



##########
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/endpoint/hive/HiveServer2Endpoint.java:
##########
@@ -321,6 +326,7 @@ public TOpenSessionResp OpenSession(TOpenSessionReq 
tOpenSessionReq) throws TExc
                                     .setDefaultCatalog(catalogName)
                                     .addSessionConfig(sessionConfig)
                                     .build());
+            // set variables to HiveConf or Session's conf

Review Comment:
   I think this comment line (329) should lay before line 315 0r 319. 



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