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
b03b5603
Commit
b03b5603
authored
May 19, 2022
by
wenmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Fix-520] [core] Fix get JobPlanInfo failed
parent
14adfd6b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
5 deletions
+25
-5
Explainer.java
dlink-core/src/main/java/com/dlink/explainer/Explainer.java
+16
-5
JobParam.java
dlink-core/src/main/java/com/dlink/job/JobParam.java
+9
-0
No files found.
dlink-core/src/main/java/com/dlink/explainer/Explainer.java
View file @
b03b5603
...
@@ -83,6 +83,7 @@ public class Explainer {
...
@@ -83,6 +83,7 @@ public class Explainer {
List
<
StatementParam
>
ddl
=
new
ArrayList
<>();
List
<
StatementParam
>
ddl
=
new
ArrayList
<>();
List
<
StatementParam
>
trans
=
new
ArrayList
<>();
List
<
StatementParam
>
trans
=
new
ArrayList
<>();
List
<
StatementParam
>
execute
=
new
ArrayList
<>();
List
<
StatementParam
>
execute
=
new
ArrayList
<>();
List
<
String
>
statementList
=
new
ArrayList
<>();
for
(
String
item
:
statements
)
{
for
(
String
item
:
statements
)
{
String
statement
=
executor
.
pretreatStatement
(
item
);
String
statement
=
executor
.
pretreatStatement
(
item
);
if
(
statement
.
isEmpty
())
{
if
(
statement
.
isEmpty
())
{
...
@@ -92,6 +93,7 @@ public class Explainer {
...
@@ -92,6 +93,7 @@ public class Explainer {
if
(
operationType
.
equals
(
SqlType
.
INSERT
)
||
operationType
.
equals
(
SqlType
.
SELECT
)
||
operationType
.
equals
(
SqlType
.
SHOW
)
if
(
operationType
.
equals
(
SqlType
.
INSERT
)
||
operationType
.
equals
(
SqlType
.
SELECT
)
||
operationType
.
equals
(
SqlType
.
SHOW
)
||
operationType
.
equals
(
SqlType
.
DESCRIBE
)
||
operationType
.
equals
(
SqlType
.
DESC
))
{
||
operationType
.
equals
(
SqlType
.
DESCRIBE
)
||
operationType
.
equals
(
SqlType
.
DESC
))
{
trans
.
add
(
new
StatementParam
(
statement
,
operationType
));
trans
.
add
(
new
StatementParam
(
statement
,
operationType
));
statementList
.
add
(
statement
);
if
(!
useStatementSet
)
{
if
(!
useStatementSet
)
{
break
;
break
;
}
}
...
@@ -99,9 +101,10 @@ public class Explainer {
...
@@ -99,9 +101,10 @@ public class Explainer {
execute
.
add
(
new
StatementParam
(
statement
,
operationType
));
execute
.
add
(
new
StatementParam
(
statement
,
operationType
));
}
else
{
}
else
{
ddl
.
add
(
new
StatementParam
(
statement
,
operationType
));
ddl
.
add
(
new
StatementParam
(
statement
,
operationType
));
statementList
.
add
(
statement
);
}
}
}
}
return
new
JobParam
(
Arrays
.
asList
(
statements
)
,
ddl
,
trans
,
execute
);
return
new
JobParam
(
statementList
,
ddl
,
trans
,
execute
);
}
}
public
List
<
SqlExplainResult
>
explainSqlResult
(
String
statement
)
{
public
List
<
SqlExplainResult
>
explainSqlResult
(
String
statement
)
{
...
@@ -259,9 +262,13 @@ public class Explainer {
...
@@ -259,9 +262,13 @@ public class Explainer {
public
ObjectNode
getStreamGraph
(
String
statement
)
{
public
ObjectNode
getStreamGraph
(
String
statement
)
{
JobParam
jobParam
=
pretreatStatements
(
SqlUtil
.
getStatements
(
statement
,
sqlSeparator
));
JobParam
jobParam
=
pretreatStatements
(
SqlUtil
.
getStatements
(
statement
,
sqlSeparator
));
if
(
jobParam
.
getDdl
().
size
()
>
0
)
{
for
(
StatementParam
statementParam:
jobParam
.
getDdl
()){
executor
.
executeSql
(
statementParam
.
getValue
());
}
}
if
(
jobParam
.
getTrans
().
size
()
>
0
)
{
if
(
jobParam
.
getTrans
().
size
()
>
0
)
{
return
executor
.
getStreamGraph
(
jobParam
.
get
Statements
());
return
executor
.
getStreamGraph
(
jobParam
.
get
TransStatement
());
}
else
if
(
jobParam
.
getExecute
().
size
()
>
0
)
{
}
else
if
(
jobParam
.
getExecute
().
size
()
>
0
)
{
List
<
String
>
datastreamPlans
=
new
ArrayList
<>();
List
<
String
>
datastreamPlans
=
new
ArrayList
<>();
for
(
StatementParam
item
:
jobParam
.
getExecute
())
{
for
(
StatementParam
item
:
jobParam
.
getExecute
())
{
...
@@ -275,9 +282,13 @@ public class Explainer {
...
@@ -275,9 +282,13 @@ public class Explainer {
public
JobPlanInfo
getJobPlanInfo
(
String
statement
)
{
public
JobPlanInfo
getJobPlanInfo
(
String
statement
)
{
JobParam
jobParam
=
pretreatStatements
(
SqlUtil
.
getStatements
(
statement
,
sqlSeparator
));
JobParam
jobParam
=
pretreatStatements
(
SqlUtil
.
getStatements
(
statement
,
sqlSeparator
));
if
(
jobParam
.
getDdl
().
size
()
>
0
)
{
for
(
StatementParam
statementParam:
jobParam
.
getDdl
()){
executor
.
executeSql
(
statementParam
.
getValue
());
}
}
if
(
jobParam
.
getTrans
().
size
()
>
0
)
{
if
(
jobParam
.
getTrans
().
size
()
>
0
)
{
return
executor
.
getJobPlanInfo
(
jobParam
.
get
Statements
());
return
executor
.
getJobPlanInfo
(
jobParam
.
get
TransStatement
());
}
else
if
(
jobParam
.
getExecute
().
size
()
>
0
)
{
}
else
if
(
jobParam
.
getExecute
().
size
()
>
0
)
{
List
<
String
>
datastreamPlans
=
new
ArrayList
<>();
List
<
String
>
datastreamPlans
=
new
ArrayList
<>();
for
(
StatementParam
item
:
jobParam
.
getExecute
())
{
for
(
StatementParam
item
:
jobParam
.
getExecute
())
{
...
...
dlink-core/src/main/java/com/dlink/job/JobParam.java
View file @
b03b5603
package
com
.
dlink
.
job
;
package
com
.
dlink
.
job
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -46,6 +47,14 @@ public class JobParam {
...
@@ -46,6 +47,14 @@ public class JobParam {
return
trans
;
return
trans
;
}
}
public
List
<
String
>
getTransStatement
()
{
List
<
String
>
statementList
=
new
ArrayList
<>();
for
(
StatementParam
statementParam:
trans
){
statementList
.
add
(
statementParam
.
getValue
());
}
return
statementList
;
}
public
void
setTrans
(
List
<
StatementParam
>
trans
)
{
public
void
setTrans
(
List
<
StatementParam
>
trans
)
{
this
.
trans
=
trans
;
this
.
trans
=
trans
;
}
}
...
...
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