zabetak commented on code in PR #6230:
URL: https://github.com/apache/hive/pull/6230#discussion_r2623693178


##########
ql/src/java/org/apache/hadoop/hive/ql/exec/ExplainTask.java:
##########
@@ -628,6 +621,42 @@ public int execute() {
     }
   }
 
+  /**
+   * Augments the JSON plan with the outputs names of ReduceSink operators.
+   * @param jsonPlan the JSON plan object that is augmented
+   */
+  private void augmentJSONWithRSOutputs(JSONObject jsonPlan) throws Exception {
+    if ("tez".equals(HiveConf.getVar(conf, 
HiveConf.ConfVars.HIVE_EXECUTION_ENGINE))) {
+      // The JSON object is augmented via side effect of TezJsonParser.print()
+      new TezJsonParser().print(jsonPlan, null);
+    }
+  }
+
+  /**
+   * Creates the appropriate JsonParser based on the ExplainWork configuration.
+   * @return a JsonParser
+   */
+  private JsonParser createParser() {
+    final JsonParser defaultParser;
+    if (HiveConf.getBoolVar(conf, ConfVars.HIVE_EXPLAIN_FORMATTED_INDENT)) {
+      defaultParser = (json, out) -> out.print(json.toString(2));
+    } else {
+      defaultParser = (json, out) -> out.print(json.toString());
+    }
+    if (work.isCbo() || work.isLogical() || work.isAuthorize() || 
work.getDependency() || work.isLocks()) {
+      return defaultParser;
+    } else if (work.isUserLevelExplain()) {
+      if (HiveConf.getVar(conf, 
HiveConf.ConfVars.HIVE_EXECUTION_ENGINE).equals("tez")) {

Review Comment:
   The `HiveConf.getVar` will never return `null` since if the property is not 
set it will return the default value. Nevertheless, it is a good pattern to 
follow and since I am updating the PR in any case I applied this change as 
well: 
https://github.com/apache/hive/pull/6230/commits/fa44b5b8cb1aa2a128182edb3ed4ad87c99c854e



##########
ql/src/java/org/apache/hadoop/hive/ql/exec/ExplainTask.java:
##########
@@ -628,6 +621,42 @@ public int execute() {
     }
   }
 
+  /**
+   * Augments the JSON plan with the outputs names of ReduceSink operators.
+   * @param jsonPlan the JSON plan object that is augmented
+   */
+  private void augmentJSONWithRSOutputs(JSONObject jsonPlan) throws Exception {
+    if ("tez".equals(HiveConf.getVar(conf, 
HiveConf.ConfVars.HIVE_EXECUTION_ENGINE))) {
+      // The JSON object is augmented via side effect of TezJsonParser.print()
+      new TezJsonParser().print(jsonPlan, null);
+    }
+  }
+
+  /**
+   * Creates the appropriate JsonParser based on the ExplainWork configuration.
+   * @return a JsonParser
+   */
+  private JsonParser createParser() {
+    final JsonParser defaultParser;

Review Comment:
   
https://github.com/apache/hive/pull/6230/commits/2a4ccaef39f6722a6e4ba66a7ed2b22a9d354fea



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