deniskuzZ commented on code in PR #5538:
URL: https://github.com/apache/hive/pull/5538#discussion_r1871411365


##########
ql/src/java/org/apache/hadoop/hive/ql/DriverContext.java:
##########
@@ -125,6 +130,17 @@ public QueryPlan getPlan() {
 
   public void setPlan(QueryPlan plan) {
     this.plan = plan;
+    // only set runtimeContext if the plan is not null
+    // we don't want to nullify runtimeContext if this method is called with 
plan=null, which is the case when e.g.
+    // driver.releasePlan() tries to release resources/objects that are known 
to be heavy
+    if (plan != null) {
+      TezTask task = 
Utilities.getFirstTezTask(plan.getRootTasks()).orElse(null);
+      this.runtimeContext = task == null ? null : task.getRuntimeContext();

Review Comment:
   minor style: i usually wrap ternary condition in round brackets, unless it's 
single boolean var 
   ````
   this.runtimeContext = (task == null) ? null : task.getRuntimeContext();
   ````
   wait, getFirstTezTask returns optional. then why not use map
   ````
   this.runtimeContext = Utilities.getFirstTezTask(plan.getRootTasks())
     .map(task -> task.getRuntimeContext())
     .orElse(null);
   ````
   



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to