[ https://issues.apache.org/jira/browse/HIVE-26167?focusedWorklogId=761800&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-761800 ]
ASF GitHub Bot logged work on HIVE-26167: ----------------------------------------- Author: ASF GitHub Bot Created on: 25/Apr/22 14:00 Start Date: 25/Apr/22 14:00 Worklog Time Spent: 10m Work Description: pvary commented on code in PR #3234: URL: https://github.com/apache/hive/pull/3234#discussion_r857660531 ########## ql/src/java/org/apache/hadoop/hive/ql/Driver.java: ########## @@ -532,6 +522,10 @@ private void prepareContext() throws CommandProcessorException { context.setHDFSCleanup(true); driverTxnHandler.setContext(context); + + if (SessionState.get() != null) { + SessionState.get().addQueryState(getConf().get(HiveConf.ConfVars.HIVEQUERYID.varname), getQueryState()); Review Comment: Would it be better to use `driverContext.getQueryState().getQueryId()` instead of depending on the conf? Issue Time Tracking ------------------- Worklog Id: (was: 761800) Time Spent: 40m (was: 0.5h) > QueryStateMap in SessionState is not maintained correctly > --------------------------------------------------------- > > Key: HIVE-26167 > URL: https://issues.apache.org/jira/browse/HIVE-26167 > Project: Hive > Issue Type: Improvement > Reporter: László Pintér > Assignee: László Pintér > Priority: Major > Labels: pull-request-available > Time Spent: 40m > Remaining Estimate: 0h > > When the Driver is the QueryStateMap is also initialized with the query ID > and the current queryState object. This record is kept in the map until the > execution of the query is completed. > There are many unit tests that initialise the driver object once during the > setup phase, and use the same object to execute all the different queries. As > a consequence, after the first execution, the QueryStateMap will be cleaned > and all subsequent queries will run into null pointer exception while trying > to fetch the current querystate from the SessionState. -- This message was sent by Atlassian Jira (v8.20.7#820007)