You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/11/14 20:29:59 UTC

[GitHub] [spark] grundprinzip commented on a diff in pull request #38638: [SPARK-41122][CONNECT] Explain API can support different modes

grundprinzip commented on code in PR #38638:
URL: https://github.com/apache/spark/pull/38638#discussion_r1022036015


##########
connector/connect/src/main/protobuf/spark/connect/base.proto:
##########
@@ -38,16 +38,50 @@ message Plan {
   }
 }
 
+// Explains the input plan based on a configurable mode.
+message Explain {
+  // Plan explanation mode.
+  enum ExplainMode {
+    MODE_UNSPECIFIED = 0;
+
+    // Generates only physical plan.
+    SIMPLE = 1;
+
+    // Generates parsed logical plan, analyzed logical plan, optimized logical plan and physical plan.
+    // Parsed Logical plan is a unresolved plan that extracted from the query. Analyzed logical plans
+    // transforms which translates unresolvedAttribute and unresolvedRelation into fully typed objects.
+    // The optimized logical plan transforms through a set of optimization rules, resulting in the
+    // physical plan.
+    EXTENDED = 2;
+
+    // Generates code for the statement, if any and a physical plan.
+    CODEGEN = 3;
+
+    // If plan node statistics are available, generates a logical plan and also the statistics.
+    COST = 4;
+
+    // Generates a physical plan outline and also node details.
+    FORMATTED = 5;
+  }
+
+  // (Required) For analyzePlan rpc calls, configure the mode to explain plan in strings.
+  ExplainMode explain_mode= 1;
+}
+
 // A request to be executed by the service.
 message Request {
   // The client_id is set by the client to be able to collate streaming responses from
   // different queries.
   string client_id = 1;
   // User context
   UserContext user_context = 2;
-  // The logical plan to be executed / analyzed.
+
+  // (Required) The logical plan to be executed / analyzed.
   Plan plan = 3;
 
+  // Used when invoking AnalyzePlan rpc calls.
+  Explain explain = 4;

Review Comment:
   I think this is probably the right time to split of the Request for Analyze and Execute because the explain message should probably not be part of the overall request.
   
   In the same way this actually, would follow the proto guidelines for the naming of the request objects to be named after their RPC method name.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org