Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
222feec1
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dbeaver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
222feec1
编写于
5月 24, 2019
作者:
A
Andrew Khitrin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Detect node kind with switch + contain
Former-commit-id:
3d1bb9ba
上级
0ae2ab11
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
190 addition
and
70 deletion
+190
-70
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/model/plan/OraclePlanNode.java
...g/jkiss/dbeaver/ext/oracle/model/plan/OraclePlanNode.java
+98
-38
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/plan/PostgrePlanNodeBase.java
...beaver/ext/postgresql/model/plan/PostgrePlanNodeBase.java
+92
-32
未找到文件。
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/model/plan/OraclePlanNode.java
浏览文件 @
222feec1
...
@@ -34,6 +34,7 @@ import java.sql.SQLException;
...
@@ -34,6 +34,7 @@ import java.sql.SQLException;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.time.Instant
;
import
java.time.Instant
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -44,6 +45,28 @@ import java.util.Map;
...
@@ -44,6 +45,28 @@ import java.util.Map;
public
class
OraclePlanNode
extends
AbstractExecutionPlanNode
implements
DBCPlanCostNode
{
public
class
OraclePlanNode
extends
AbstractExecutionPlanNode
implements
DBCPlanCostNode
{
public
final
static
String
CAT_DETAILS
=
"Details"
;
public
final
static
String
CAT_DETAILS
=
"Details"
;
private
final
static
List
<
String
>
allowedKind
=
new
ArrayList
<>(
Arrays
.
asList
(
"result"
,
"project"
,
"filter"
,
"collector"
,
"index"
,
"hash"
,
"foregin"
,
"aggregate"
,
"modify"
,
"inset"
,
"update"
,
"delete"
,
"loop"
,
"join"
,
"merge"
,
"sort"
,
"merge"
,
"group"
,
"materialize"
,
"function"
));
private
final
OracleDataSource
dataSource
;
private
final
OracleDataSource
dataSource
;
private
String
statementId
;
private
String
statementId
;
...
@@ -85,6 +108,8 @@ public class OraclePlanNode extends AbstractExecutionPlanNode implements DBCPlan
...
@@ -85,6 +108,8 @@ public class OraclePlanNode extends AbstractExecutionPlanNode implements DBCPlan
private
OraclePlanNode
parent
;
private
OraclePlanNode
parent
;
protected
final
List
<
OraclePlanNode
>
nested
=
new
ArrayList
<>();
protected
final
List
<
OraclePlanNode
>
nested
=
new
ArrayList
<>();
private
String
aGetString
(
Map
<
String
,
String
>
attributes
,
String
name
)
{
private
String
aGetString
(
Map
<
String
,
String
>
attributes
,
String
name
)
{
return
attributes
.
containsKey
(
name
)
?
attributes
.
get
(
name
).
toString
()
:
""
;
return
attributes
.
containsKey
(
name
)
?
attributes
.
get
(
name
).
toString
()
:
""
;
...
@@ -127,46 +152,81 @@ public class OraclePlanNode extends AbstractExecutionPlanNode implements DBCPlan
...
@@ -127,46 +152,81 @@ public class OraclePlanNode extends AbstractExecutionPlanNode implements DBCPlan
}
}
}
}
@Override
@Override
public
DBCPlanNodeKind
getNodeKind
()
{
public
DBCPlanNodeKind
getNodeKind
()
{
if
(
operation
.
toLowerCase
().
indexOf
(
"result"
)
>=
0
)
{
return
DBCPlanNodeKind
.
RESULT
;
String
op
=
operation
.
toLowerCase
();
}
else
if
(
operation
.
toLowerCase
().
indexOf
(
"project"
)
>=
0
)
{
return
DBCPlanNodeKind
.
SET
;
for
(
String
kind
:
allowedKind
)
{
}
else
if
(
operation
.
toLowerCase
().
indexOf
(
"filter"
)
>=
0
)
{
if
(
op
.
contains
(
kind
))
{
return
DBCPlanNodeKind
.
FILTER
;
}
else
if
(
operation
.
toLowerCase
().
indexOf
(
"collector"
)
>=
0
)
{
switch
(
kind
)
{
return
DBCPlanNodeKind
.
AGGREGATE
;
}
else
if
(
operation
.
toLowerCase
().
indexOf
(
"index"
)
>=
0
)
{
case
"result"
:
return
DBCPlanNodeKind
.
INDEX_SCAN
;
return
DBCPlanNodeKind
.
RESULT
;
}
else
if
(
operation
.
toLowerCase
().
indexOf
(
"hash"
)
>=
0
)
{
return
DBCPlanNodeKind
.
HASH
;
case
"project"
:
}
else
if
(
operation
.
toLowerCase
().
indexOf
(
"foregin"
)
>=
0
)
{
return
DBCPlanNodeKind
.
SET
;
return
DBCPlanNodeKind
.
TABLE_SCAN
;
}
else
if
(
operation
.
toLowerCase
().
indexOf
(
"aggregate"
)
>=
0
)
{
case
"filter"
:
return
DBCPlanNodeKind
.
AGGREGATE
;
return
DBCPlanNodeKind
.
FILTER
;
}
else
if
(
operation
.
toLowerCase
().
indexOf
(
"modify"
)
>=
0
||
operation
.
toLowerCase
().
indexOf
(
"inset"
)
>=
0
||
case
"collector"
:
operation
.
toLowerCase
().
indexOf
(
"update"
)
>=
0
||
return
DBCPlanNodeKind
.
AGGREGATE
;
operation
.
toLowerCase
().
indexOf
(
"delete"
)
>=
0
)
{
return
DBCPlanNodeKind
.
MODIFY
;
case
"index"
:
}
else
if
(
operation
.
toLowerCase
().
indexOf
(
"loop"
)
>=
0
||
return
DBCPlanNodeKind
.
INDEX_SCAN
;
operation
.
toLowerCase
().
indexOf
(
"join"
)
>=
0
)
{
return
DBCPlanNodeKind
.
JOIN
;
case
"hash"
:
}
else
if
(
operation
.
toLowerCase
().
indexOf
(
"merge"
)
>=
0
)
{
return
DBCPlanNodeKind
.
HASH
;
return
DBCPlanNodeKind
.
MERGE
;
}
else
if
(
operation
.
toLowerCase
().
indexOf
(
"sort"
)
>=
0
)
{
case
"foregin"
:
return
DBCPlanNodeKind
.
SORT
;
return
DBCPlanNodeKind
.
TABLE_SCAN
;
}
else
if
(
operation
.
toLowerCase
().
indexOf
(
"merge"
)
>=
0
)
{
return
DBCPlanNodeKind
.
MERGE
;
case
"aggregate"
:
}
else
if
(
operation
.
toLowerCase
().
indexOf
(
"group"
)
>=
0
)
{
return
DBCPlanNodeKind
.
AGGREGATE
;
return
DBCPlanNodeKind
.
GROUP
;
}
else
if
(
operation
.
toLowerCase
().
indexOf
(
"materialize"
)
>=
0
)
{
case
"modify"
:
return
DBCPlanNodeKind
.
MATERIALIZE
;
return
DBCPlanNodeKind
.
MODIFY
;
}
else
if
(
operation
.
toLowerCase
().
indexOf
(
"function"
)
>=
0
)
{
return
DBCPlanNodeKind
.
FUNCTION
;
case
"insert"
:
return
DBCPlanNodeKind
.
MODIFY
;
case
"update"
:
return
DBCPlanNodeKind
.
MODIFY
;
case
"delete"
:
return
DBCPlanNodeKind
.
MODIFY
;
case
"loop"
:
return
DBCPlanNodeKind
.
JOIN
;
case
"join"
:
return
DBCPlanNodeKind
.
JOIN
;
case
"merge"
:
return
DBCPlanNodeKind
.
MERGE
;
case
"sort"
:
return
DBCPlanNodeKind
.
SORT
;
case
"group"
:
return
DBCPlanNodeKind
.
GROUP
;
case
"materialize"
:
return
DBCPlanNodeKind
.
MATERIALIZE
;
case
"function"
:
return
DBCPlanNodeKind
.
FUNCTION
;
default
:
return
DBCPlanNodeKind
.
DEFAULT
;
}
}
}
}
return
DBCPlanNodeKind
.
DEFAULT
;
return
DBCPlanNodeKind
.
DEFAULT
;
}
}
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/plan/PostgrePlanNodeBase.java
浏览文件 @
222feec1
...
@@ -52,6 +52,26 @@ public abstract class PostgrePlanNodeBase<NODE extends PostgrePlanNodeBase<?>> e
...
@@ -52,6 +52,26 @@ public abstract class PostgrePlanNodeBase<NODE extends PostgrePlanNodeBase<?>> e
public
static
final
String
ATTR_OBJECT_NAME
=
"Object name"
;
public
static
final
String
ATTR_OBJECT_NAME
=
"Object name"
;
private
final
static
List
<
String
>
allowedKind
=
new
ArrayList
<>(
Arrays
.
asList
(
"result"
,
"project"
,
"index"
,
"hash"
,
"foregin"
,
"aggregate"
,
"modify"
,
"inset"
,
"update"
,
"delete"
,
"loop"
,
"join"
,
"merge"
,
"sort"
,
"merge"
,
"group"
,
"materialize"
,
"function"
));
private
PostgreDataSource
dataSource
;
private
PostgreDataSource
dataSource
;
protected
NODE
parent
;
protected
NODE
parent
;
protected
final
List
<
NODE
>
nested
=
new
ArrayList
<>();
protected
final
List
<
NODE
>
nested
=
new
ArrayList
<>();
...
@@ -203,39 +223,79 @@ public abstract class PostgrePlanNodeBase<NODE extends PostgrePlanNodeBase<?>> e
...
@@ -203,39 +223,79 @@ public abstract class PostgrePlanNodeBase<NODE extends PostgrePlanNodeBase<?>> e
@Override
@Override
public
DBCPlanNodeKind
getNodeKind
()
{
public
DBCPlanNodeKind
getNodeKind
()
{
if
(
nodeType
.
toLowerCase
().
indexOf
(
"result"
)
>=
0
)
{
return
DBCPlanNodeKind
.
RESULT
;
String
op
=
nodeType
.
toLowerCase
();
}
else
if
(
nodeType
.
toLowerCase
().
indexOf
(
"project"
)
>=
0
)
{
return
DBCPlanNodeKind
.
SET
;
for
(
String
kind
:
allowedKind
)
{
}
else
if
(
nodeType
.
toLowerCase
().
indexOf
(
"index"
)
>=
0
)
{
if
(
op
.
contains
(
kind
))
{
return
DBCPlanNodeKind
.
INDEX_SCAN
;
}
else
if
(
nodeType
.
toLowerCase
().
indexOf
(
"hash"
)
>=
0
)
{
switch
(
kind
)
{
return
DBCPlanNodeKind
.
HASH
;
}
else
if
(
nodeType
.
toLowerCase
().
indexOf
(
"foregin"
)
>=
0
)
{
case
"result"
:
return
DBCPlanNodeKind
.
TABLE_SCAN
;
return
DBCPlanNodeKind
.
RESULT
;
}
else
if
(
nodeType
.
toLowerCase
().
indexOf
(
"aggregate"
)
>=
0
)
{
return
DBCPlanNodeKind
.
AGGREGATE
;
case
"project"
:
}
else
if
(
nodeType
.
toLowerCase
().
indexOf
(
"modify"
)
>=
0
||
return
DBCPlanNodeKind
.
SET
;
nodeType
.
toLowerCase
().
indexOf
(
"inset"
)
>=
0
||
nodeType
.
toLowerCase
().
indexOf
(
"update"
)
>=
0
||
case
"filter"
:
nodeType
.
toLowerCase
().
indexOf
(
"delete"
)
>=
0
)
{
return
DBCPlanNodeKind
.
FILTER
;
return
DBCPlanNodeKind
.
MODIFY
;
}
else
if
(
nodeType
.
toLowerCase
().
indexOf
(
"loop"
)
>=
0
||
case
"collector"
:
nodeType
.
toLowerCase
().
indexOf
(
"join"
)
>=
0
)
{
return
DBCPlanNodeKind
.
AGGREGATE
;
return
DBCPlanNodeKind
.
JOIN
;
}
else
if
(
nodeType
.
toLowerCase
().
indexOf
(
"merge"
)
>=
0
)
{
case
"index"
:
return
DBCPlanNodeKind
.
MERGE
;
return
DBCPlanNodeKind
.
INDEX_SCAN
;
}
else
if
(
nodeType
.
toLowerCase
().
indexOf
(
"sort"
)
>=
0
)
{
return
DBCPlanNodeKind
.
SORT
;
case
"hash"
:
}
else
if
(
nodeType
.
toLowerCase
().
indexOf
(
"merge"
)
>=
0
)
{
return
DBCPlanNodeKind
.
HASH
;
return
DBCPlanNodeKind
.
MERGE
;
}
else
if
(
nodeType
.
toLowerCase
().
indexOf
(
"group"
)
>=
0
)
{
case
"foregin"
:
return
DBCPlanNodeKind
.
GROUP
;
return
DBCPlanNodeKind
.
TABLE_SCAN
;
}
else
if
(
nodeType
.
toLowerCase
().
indexOf
(
"materialize"
)
>=
0
)
{
return
DBCPlanNodeKind
.
MATERIALIZE
;
case
"aggregate"
:
}
else
if
(
nodeType
.
toLowerCase
().
indexOf
(
"function"
)
>=
0
)
{
return
DBCPlanNodeKind
.
AGGREGATE
;
return
DBCPlanNodeKind
.
FUNCTION
;
case
"modify"
:
return
DBCPlanNodeKind
.
MODIFY
;
case
"insert"
:
return
DBCPlanNodeKind
.
MODIFY
;
case
"update"
:
return
DBCPlanNodeKind
.
MODIFY
;
case
"delete"
:
return
DBCPlanNodeKind
.
MODIFY
;
case
"loop"
:
return
DBCPlanNodeKind
.
JOIN
;
case
"join"
:
return
DBCPlanNodeKind
.
JOIN
;
case
"merge"
:
return
DBCPlanNodeKind
.
MERGE
;
case
"sort"
:
return
DBCPlanNodeKind
.
SORT
;
case
"group"
:
return
DBCPlanNodeKind
.
GROUP
;
case
"materialize"
:
return
DBCPlanNodeKind
.
MATERIALIZE
;
case
"function"
:
return
DBCPlanNodeKind
.
FUNCTION
;
default
:
return
DBCPlanNodeKind
.
DEFAULT
;
}
}
}
}
return
DBCPlanNodeKind
.
DEFAULT
;
return
DBCPlanNodeKind
.
DEFAULT
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录