skywalker0618 commented on code in PR #19812:
URL: https://github.com/apache/hudi/pull/19812#discussion_r3929782775
##########
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/ddl/HiveQueryDDLExecutor.java:
##########
@@ -183,6 +180,12 @@ private List<CommandProcessorResponse>
updateHiveSQLs(List<String> sqls) {
}
} catch (Exception e) {
throw new HoodieHiveSyncException("Failed in executing SQL", e);
+ } finally {
+ if (previousSession != null) {
+ SessionState.setCurrentSessionState(previousSession);
+ } else {
+ SessionState.detachSession();
Review Comment:
Done
##########
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/ddl/HiveQueryDDLExecutor.java:
##########
@@ -84,20 +83,10 @@ public HiveQueryDDLExecutor(HiveSyncConfig config,
IMetaStoreClient metaStoreCli
this.sessionState.setCurrentDatabase(databaseName);
this.hiveDriver = new
org.apache.hadoop.hive.ql.Driver(config.getHiveConf());
} catch (Exception e) {
- if (sessionState != null) {
- try {
- this.sessionState.close();
- } catch (IOException ioException) {
- log.error("Error while closing SessionState", ioException);
- }
- }
- if (this.hiveDriver != null) {
- try {
- this.hiveDriver.close();
- } catch (Exception driverCloseException) {
- log.error("Error while closing Hive Driver", driverCloseException);
- }
- destroyQuietly(this.hiveDriver);
+ try {
+ closeDriverAndSession();
Review Comment:
Done
--
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]