Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dlink
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaowei
dlink
Commits
759706cb
Unverified
Commit
759706cb
authored
Jun 17, 2022
by
aiwenmo
Committed by
GitHub
Jun 17, 2022
Browse files
Options
Browse Files
Download
Plain Diff
[Optimization][client] explainSqlRecord 方法优化
[Optimization][client] explainSqlRecord 方法优化
parents
16a4cdff
c2f970d0
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
85 deletions
+61
-85
CustomTableEnvironmentImpl.java
...n/java/com/dlink/executor/CustomTableEnvironmentImpl.java
+12
-17
CustomTableEnvironmentImpl.java
...n/java/com/dlink/executor/CustomTableEnvironmentImpl.java
+12
-17
CustomTableEnvironmentImpl.java
...n/java/com/dlink/executor/CustomTableEnvironmentImpl.java
+12
-17
CustomTableEnvironmentImpl.java
...n/java/com/dlink/executor/CustomTableEnvironmentImpl.java
+13
-17
CustomTableEnvironmentImpl.java
...n/java/com/dlink/executor/CustomTableEnvironmentImpl.java
+12
-17
No files found.
dlink-client/dlink-client-1.11/src/main/java/com/dlink/executor/CustomTableEnvironmentImpl.java
View file @
759706cb
...
@@ -250,9 +250,7 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
...
@@ -250,9 +250,7 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
throw
new
TableException
(
throw
new
TableException
(
"Unsupported SQL query! explainSql() only accepts a single SQL query."
);
"Unsupported SQL query! explainSql() only accepts a single SQL query."
);
}
}
List
<
Operation
>
operationlist
=
new
ArrayList
<>(
operations
);
Operation
operation
=
operations
.
get
(
0
);
for
(
int
i
=
0
;
i
<
operationlist
.
size
();
i
++)
{
Operation
operation
=
operationlist
.
get
(
i
);
if
(
operation
instanceof
ModifyOperation
)
{
if
(
operation
instanceof
ModifyOperation
)
{
record
.
setType
(
"Modify DML"
);
record
.
setType
(
"Modify DML"
);
}
else
if
(
operation
instanceof
ExplainOperation
)
{
}
else
if
(
operation
instanceof
ExplainOperation
)
{
...
@@ -261,16 +259,13 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
...
@@ -261,16 +259,13 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
record
.
setType
(
"Query DML"
);
record
.
setType
(
"Query DML"
);
}
else
{
}
else
{
record
.
setExplain
(
operation
.
asSummaryString
());
record
.
setExplain
(
operation
.
asSummaryString
());
operationlist
.
remove
(
i
);
record
.
setType
(
"DDL"
);
record
.
setType
(
"DDL"
);
i
=
i
-
1
;
}
}
}
record
.
setExplainTrue
(
true
);
record
.
setExplainTrue
(
true
);
if
(
operationlist
.
size
()
==
0
)
{
if
(
"DDL"
.
equals
(
record
.
getType
())
)
{
return
record
;
return
record
;
}
}
record
.
setExplain
(
planner
.
explain
(
operation
list
,
extraDetails
));
record
.
setExplain
(
planner
.
explain
(
operation
s
,
extraDetails
));
return
record
;
return
record
;
}
}
...
...
dlink-client/dlink-client-1.12/src/main/java/com/dlink/executor/CustomTableEnvironmentImpl.java
View file @
759706cb
...
@@ -252,9 +252,7 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
...
@@ -252,9 +252,7 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
throw
new
TableException
(
throw
new
TableException
(
"Unsupported SQL query! explainSql() only accepts a single SQL query."
);
"Unsupported SQL query! explainSql() only accepts a single SQL query."
);
}
}
List
<
Operation
>
operationlist
=
new
ArrayList
<>(
operations
);
Operation
operation
=
operations
.
get
(
0
);
for
(
int
i
=
0
;
i
<
operationlist
.
size
();
i
++)
{
Operation
operation
=
operationlist
.
get
(
i
);
if
(
operation
instanceof
ModifyOperation
)
{
if
(
operation
instanceof
ModifyOperation
)
{
record
.
setType
(
"Modify DML"
);
record
.
setType
(
"Modify DML"
);
}
else
if
(
operation
instanceof
ExplainOperation
)
{
}
else
if
(
operation
instanceof
ExplainOperation
)
{
...
@@ -263,16 +261,13 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
...
@@ -263,16 +261,13 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
record
.
setType
(
"Query DML"
);
record
.
setType
(
"Query DML"
);
}
else
{
}
else
{
record
.
setExplain
(
operation
.
asSummaryString
());
record
.
setExplain
(
operation
.
asSummaryString
());
operationlist
.
remove
(
i
);
record
.
setType
(
"DDL"
);
record
.
setType
(
"DDL"
);
i
=
i
-
1
;
}
}
}
record
.
setExplainTrue
(
true
);
record
.
setExplainTrue
(
true
);
if
(
operationlist
.
size
()
==
0
)
{
if
(
"DDL"
.
equals
(
record
.
getType
())
)
{
return
record
;
return
record
;
}
}
record
.
setExplain
(
planner
.
explain
(
operation
list
,
extraDetails
));
record
.
setExplain
(
planner
.
explain
(
operation
s
,
extraDetails
));
return
record
;
return
record
;
}
}
...
...
dlink-client/dlink-client-1.13/src/main/java/com/dlink/executor/CustomTableEnvironmentImpl.java
View file @
759706cb
...
@@ -253,9 +253,7 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
...
@@ -253,9 +253,7 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
throw
new
TableException
(
throw
new
TableException
(
"Unsupported SQL query! explainSql() only accepts a single SQL query."
);
"Unsupported SQL query! explainSql() only accepts a single SQL query."
);
}
}
List
<
Operation
>
operationlist
=
new
ArrayList
<>(
operations
);
Operation
operation
=
operations
.
get
(
0
);
for
(
int
i
=
0
;
i
<
operationlist
.
size
();
i
++)
{
Operation
operation
=
operationlist
.
get
(
i
);
if
(
operation
instanceof
ModifyOperation
)
{
if
(
operation
instanceof
ModifyOperation
)
{
record
.
setType
(
"Modify DML"
);
record
.
setType
(
"Modify DML"
);
}
else
if
(
operation
instanceof
ExplainOperation
)
{
}
else
if
(
operation
instanceof
ExplainOperation
)
{
...
@@ -264,17 +262,14 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
...
@@ -264,17 +262,14 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
record
.
setType
(
"Query DML"
);
record
.
setType
(
"Query DML"
);
}
else
{
}
else
{
record
.
setExplain
(
operation
.
asSummaryString
());
record
.
setExplain
(
operation
.
asSummaryString
());
operationlist
.
remove
(
i
);
record
.
setType
(
"DDL"
);
record
.
setType
(
"DDL"
);
i
=
i
-
1
;
}
}
}
record
.
setExplainTrue
(
true
);
record
.
setExplainTrue
(
true
);
if
(
operationlist
.
size
()
==
0
)
{
if
(
"DDL"
.
equals
(
record
.
getType
())
)
{
//record.setExplain("DDL语句不进行解释。");
//record.setExplain("DDL语句不进行解释。");
return
record
;
return
record
;
}
}
record
.
setExplain
(
planner
.
explain
(
operation
list
,
extraDetails
));
record
.
setExplain
(
planner
.
explain
(
operation
s
,
extraDetails
));
return
record
;
return
record
;
}
}
...
...
dlink-client/dlink-client-1.14/src/main/java/com/dlink/executor/CustomTableEnvironmentImpl.java
View file @
759706cb
...
@@ -261,9 +261,8 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
...
@@ -261,9 +261,8 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
throw
new
TableException
(
throw
new
TableException
(
"Unsupported SQL query! explainSql() only accepts a single SQL query."
);
"Unsupported SQL query! explainSql() only accepts a single SQL query."
);
}
}
List
<
Operation
>
operationlist
=
new
ArrayList
<>(
operations
);
for
(
int
i
=
0
;
i
<
operationlist
.
size
();
i
++)
{
Operation
operation
=
operations
.
get
(
0
);
Operation
operation
=
operationlist
.
get
(
i
);
if
(
operation
instanceof
ModifyOperation
)
{
if
(
operation
instanceof
ModifyOperation
)
{
record
.
setType
(
"Modify DML"
);
record
.
setType
(
"Modify DML"
);
}
else
if
(
operation
instanceof
ExplainOperation
)
{
}
else
if
(
operation
instanceof
ExplainOperation
)
{
...
@@ -272,17 +271,14 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
...
@@ -272,17 +271,14 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
record
.
setType
(
"Query DML"
);
record
.
setType
(
"Query DML"
);
}
else
{
}
else
{
record
.
setExplain
(
operation
.
asSummaryString
());
record
.
setExplain
(
operation
.
asSummaryString
());
operationlist
.
remove
(
i
);
record
.
setType
(
"DDL"
);
record
.
setType
(
"DDL"
);
i
=
i
-
1
;
}
}
}
record
.
setExplainTrue
(
true
);
record
.
setExplainTrue
(
true
);
if
(
operationlist
.
size
()
==
0
)
{
if
(
"DDL"
.
equals
(
record
.
getType
())
)
{
//record.setExplain("DDL语句不进行解释。");
//record.setExplain("DDL语句不进行解释。");
return
record
;
return
record
;
}
}
record
.
setExplain
(
planner
.
explain
(
operation
list
,
extraDetails
));
record
.
setExplain
(
planner
.
explain
(
operation
s
,
extraDetails
));
return
record
;
return
record
;
}
}
...
...
dlink-client/dlink-client-1.15/src/main/java/com/dlink/executor/CustomTableEnvironmentImpl.java
View file @
759706cb
...
@@ -214,9 +214,7 @@ public class CustomTableEnvironmentImpl extends AbstractStreamTableEnvironmentIm
...
@@ -214,9 +214,7 @@ public class CustomTableEnvironmentImpl extends AbstractStreamTableEnvironmentIm
throw
new
TableException
(
throw
new
TableException
(
"Unsupported SQL query! explainSql() only accepts a single SQL query."
);
"Unsupported SQL query! explainSql() only accepts a single SQL query."
);
}
}
List
<
Operation
>
operationlist
=
new
ArrayList
<>(
operations
);
Operation
operation
=
operations
.
get
(
0
);
for
(
int
i
=
0
;
i
<
operationlist
.
size
();
i
++)
{
Operation
operation
=
operationlist
.
get
(
i
);
if
(
operation
instanceof
ModifyOperation
)
{
if
(
operation
instanceof
ModifyOperation
)
{
record
.
setType
(
"Modify DML"
);
record
.
setType
(
"Modify DML"
);
}
else
if
(
operation
instanceof
ExplainOperation
)
{
}
else
if
(
operation
instanceof
ExplainOperation
)
{
...
@@ -225,17 +223,14 @@ public class CustomTableEnvironmentImpl extends AbstractStreamTableEnvironmentIm
...
@@ -225,17 +223,14 @@ public class CustomTableEnvironmentImpl extends AbstractStreamTableEnvironmentIm
record
.
setType
(
"Query DML"
);
record
.
setType
(
"Query DML"
);
}
else
{
}
else
{
record
.
setExplain
(
operation
.
asSummaryString
());
record
.
setExplain
(
operation
.
asSummaryString
());
operationlist
.
remove
(
i
);
record
.
setType
(
"DDL"
);
record
.
setType
(
"DDL"
);
i
=
i
-
1
;
}
}
}
record
.
setExplainTrue
(
true
);
record
.
setExplainTrue
(
true
);
if
(
operationlist
.
size
()
==
0
)
{
if
(
"DDL"
.
equals
(
record
.
getType
())
)
{
//record.setExplain("DDL语句不进行解释。");
//record.setExplain("DDL语句不进行解释。");
return
record
;
return
record
;
}
}
record
.
setExplain
(
planner
.
explain
(
operation
list
,
extraDetails
));
record
.
setExplain
(
planner
.
explain
(
operation
s
,
extraDetails
));
return
record
;
return
record
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment