This is an automated email from the ASF dual-hosted git repository.
huajianlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 3a0aae1b82 [enhancement](explain)add projections and output id in
explain string (#12358)
3a0aae1b82 is described below
commit 3a0aae1b82dfa18da3959ad3510645b282d9c815
Author: morrySnow <[email protected]>
AuthorDate: Tue Sep 6 21:03:02 2022 +0800
[enhancement](explain)add projections and output id in explain string
(#12358)
In earlier PR #11842, we add the ability of projection on each ExecNode.
But, we cannot get the projection expr list in explain. This is
inconvenience to debug.
This PR add them into explain string if they exist.
---
.../java/org/apache/doris/planner/PlanNode.java | 6 ++++
.../suites/nereids_syntax_p0/explain.groovy | 33 ++++++++++++++++++++++
2 files changed, 39 insertions(+)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/PlanNode.java
b/fe/fe-core/src/main/java/org/apache/doris/planner/PlanNode.java
index 596897c947..567bcc093b 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/PlanNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/PlanNode.java
@@ -49,6 +49,7 @@ import com.google.common.base.Preconditions;
import com.google.common.base.Predicates;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
+import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.Collection;
@@ -474,6 +475,11 @@ public abstract class PlanNode extends TreeNode<PlanNode>
implements PlanStats {
if (limit != -1) {
expBuilder.append(detailPrefix + "limit: " + limit + "\n");
}
+ if (!CollectionUtils.isEmpty(projectList)) {
+ expBuilder.append(detailPrefix).append("projections:
").append(getExplainString(projectList)).append("\n");
+ expBuilder.append(detailPrefix).append("project output tuple id: ")
+ .append(outputTupleDesc.getId().asInt()).append("\n");
+ }
// Output Tuple Ids only when explain plan level is set to verbose
if (detailLevel.equals(TExplainLevel.VERBOSE)) {
expBuilder.append(detailPrefix + "tuple ids: ");
diff --git a/regression-test/suites/nereids_syntax_p0/explain.groovy
b/regression-test/suites/nereids_syntax_p0/explain.groovy
new file mode 100644
index 0000000000..865e08d553
--- /dev/null
+++ b/regression-test/suites/nereids_syntax_p0/explain.groovy
@@ -0,0 +1,33 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("explain") {
+ sql """
+ SET enable_vectorized_engine=true
+ """
+
+ sql """
+ SET enable_nereids_planner=true
+ """
+
+ explain {
+ sql("select count(2) + 1, sum(2) + sum(lo_suppkey) from lineorder")
+ contains "projections: lo_suppkey"
+ contains "project output tuple id: 1"
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]