deniskuzZ commented on a change in pull request #1087: URL: https://github.com/apache/hive/pull/1087#discussion_r446123907
########## File path: ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java ########## @@ -2392,33 +2392,29 @@ public static TableSnapshot getTableSnapshot(Configuration conf, long writeId = -1; ValidWriteIdList validWriteIdList = null; - HiveTxnManager sessionTxnMgr = SessionState.get().getTxnMgr(); - String fullTableName = getFullTableName(dbName, tblName); - if (sessionTxnMgr != null && sessionTxnMgr.getCurrentTxnId() > 0) { - validWriteIdList = getTableValidWriteIdList(conf, fullTableName); - if (isStatsUpdater) { - writeId = SessionState.get().getTxnMgr() != null ? - SessionState.get().getTxnMgr().getAllocatedTableWriteId( - dbName, tblName) : -1; - if (writeId < 1) { - // TODO: this is not ideal... stats updater that doesn't have write ID is currently - // "create table"; writeId would be 0/-1 here. No need to call this w/true. - LOG.debug("Stats updater for {}.{} doesn't have a write ID ({})", - dbName, tblName, writeId); + if (SessionState.get() != null) { + HiveTxnManager sessionTxnMgr = SessionState.get().getTxnMgr(); + String fullTableName = getFullTableName(dbName, tblName); + if (sessionTxnMgr != null && sessionTxnMgr.getCurrentTxnId() > 0) { + validWriteIdList = getTableValidWriteIdList(conf, fullTableName); + if (isStatsUpdater) { + writeId = sessionTxnMgr != null ? sessionTxnMgr.getAllocatedTableWriteId(dbName, tblName) : -1; Review comment: redundant check (sessionTxnMgr != null), see if condition above ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org