zabetak commented on code in PR #5872: URL: https://github.com/apache/hive/pull/5872#discussion_r2156385533
########## ql/src/java/org/apache/hadoop/hive/ql/exec/ExplainTask.java: ########## @@ -1003,6 +1003,9 @@ public JSONObject outputPlan(Object work, PrintStream out, Operator<? extends OperatorDesc> operator = (Operator<? extends OperatorDesc>) work; final int visitCnt = operatorVisits.merge(operator, 1, Integer::sum); + if (conf == null && this.work != null && this.work.getFetchTask() != null) { + conf = this.work.getFetchTask().getConf(); + } Review Comment: Regarding 1., I was thinking that changing just a bit HiveHookEventProtoPartialBuilder should work to avoid this NPE: ```java private JSONObject getExplainJSON(ExplainWork explainWork) throws Exception { ExplainTask explain = (ExplainTask) TaskFactory.get(explainWork, new HiveConf()); return explain.getJSONPlan(null, explainWork, stageIdRearrange); } ``` This approach seems better than 4, although it doesn't eliminate the potential NPE from other code paths. The limit could also become part of the `ExplainConfiguration` but I guess this change would have bigger impact. Anyways, there are many more options, so I will leave the final decision up to you. -- 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: gitbox-unsubscr...@hive.apache.org 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