提交 6780a17e 编写于 作者: S Serge Rider

Plan renderer enhancements

上级 2734e0be
......@@ -22,6 +22,7 @@ import org.jkiss.dbeaver.model.exec.DBCSession;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCSession;
import org.jkiss.dbeaver.model.exec.plan.DBCPlanCostNode;
import org.jkiss.dbeaver.model.exec.plan.DBCPlanNode;
import org.jkiss.dbeaver.model.impl.plan.AbstractExecutionPlan;
import org.jkiss.dbeaver.model.sql.SQLUtils;
......@@ -46,6 +47,14 @@ public class MySQLPlanAnalyser extends AbstractExecutionPlan {
this.query = query;
}
@Override
public Object getPlanFeature(String feature) {
if (DBCPlanCostNode.FEATURE_PLAN_ROWS.equals(feature)) {
return true;
}
return super.getPlanFeature(feature);
}
@Override
public String getQueryString() {
return query;
......
......@@ -17,7 +17,7 @@
package org.jkiss.dbeaver.ext.mysql.model.plan;
import org.jkiss.dbeaver.model.exec.plan.DBCPlanCostNode;
import org.jkiss.dbeaver.model.exec.plan.DBCPlanNode;
import org.jkiss.dbeaver.model.exec.plan.DBCPlanNodeKind;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.impl.plan.AbstractExecutionPlanNode;
import org.jkiss.dbeaver.model.meta.Property;
......@@ -126,6 +126,18 @@ public class MySQLPlanNode extends AbstractExecutionPlanNode implements DBCPlanC
return table;
}
@Override
public DBCPlanNodeKind getNodeKind() {
if ("SIMPLE".equals(selectType)) {
return DBCPlanNodeKind.SELECT;
} else if ("JOIN".equals(selectType)) {
return DBCPlanNodeKind.JOIN;
} else if ("UNION".equals(selectType)) {
return DBCPlanNodeKind.UNION;
}
return super.getNodeKind();
}
@Override
public String getNodeDescription() {
return ref;
......
......@@ -59,8 +59,9 @@ public class OraclePlanAnalyser extends AbstractExecutionPlan {
@Override
public Object getPlanFeature(String feature) {
if (DBCPlanCostNode.FEATURE_PLAN_COST.equalsIgnoreCase(feature) |
DBCPlanCostNode.FEATURE_PLAN_DURATION.equalsIgnoreCase(feature))
if (DBCPlanCostNode.FEATURE_PLAN_COST.equals(feature) ||
DBCPlanCostNode.FEATURE_PLAN_DURATION.equals(feature) ||
DBCPlanCostNode.FEATURE_PLAN_ROWS.equals(feature))
{
return true;
} else if (DBCPlanCostNode.PLAN_DURATION_MEASURE.equals(feature)) {
......
......@@ -56,8 +56,9 @@ public class PostgrePlanAnalyser extends AbstractExecutionPlan {
@Override
public Object getPlanFeature(String feature) {
if (DBCPlanCostNode.FEATURE_PLAN_COST.equalsIgnoreCase(feature) |
DBCPlanCostNode.FEATURE_PLAN_DURATION.equalsIgnoreCase(feature))
if (DBCPlanCostNode.FEATURE_PLAN_COST.equals(feature) ||
DBCPlanCostNode.FEATURE_PLAN_DURATION.equals(feature) ||
DBCPlanCostNode.FEATURE_PLAN_ROWS.equals(feature))
{
return true;
}
......
......@@ -26,6 +26,8 @@ import java.util.Collection;
*/
public interface DBCPlanNode extends DBPObject {
DBCPlanNodeKind getNodeKind();
String getNodeName();
String getNodeType();
......
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2019 Serge Rider (serge@jkiss.org)
*
* Licensed 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.
*/
package org.jkiss.dbeaver.model.exec.plan;
import org.jkiss.dbeaver.model.impl.struct.RelationalObjectType;
import org.jkiss.dbeaver.model.struct.DBSObjectType;
/**
* Execution plan node kind
*/
public enum DBCPlanNodeKind {
DEFAULT("Node", null),
SELECT("Select", null),
TABLE_SCAN("Table scan", RelationalObjectType.TYPE_TABLE),
INDEX_SCAN("Index scan", RelationalObjectType.TYPE_INDEX),
JOIN("Join", null),
UNION("Union", null),
FILTER("Filter", null),
AGGREGATE("Aggregate", null),
SORT("Sort", null);
private final String title;
private final DBSObjectType objectType;
DBCPlanNodeKind(String title, DBSObjectType objectType) {
this.title = title;
this.objectType = objectType;
}
public String getTitle() {
return title;
}
public DBSObjectType getObjectType() {
return objectType;
}
}
\ No newline at end of file
......@@ -18,12 +18,18 @@
package org.jkiss.dbeaver.model.impl.plan;
import org.jkiss.dbeaver.model.exec.plan.DBCPlanNode;
import org.jkiss.dbeaver.model.exec.plan.DBCPlanNodeKind;
/**
* Abstract execution plan
*/
public abstract class AbstractExecutionPlanNode implements DBCPlanNode {
@Override
public DBCPlanNodeKind getNodeKind() {
return null;
}
@Override
public String getNodeCondition() {
return null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册