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
c2d72cda
Commit
c2d72cda
authored
Jul 17, 2021
by
wenmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
字段血缘
parent
0c8bbc72
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
ColumnCAGenerator.java
...c/main/java/com/dlink/explainer/ca/ColumnCAGenerator.java
+7
-6
TableCAGenerator.java
...rc/main/java/com/dlink/explainer/ca/TableCAGenerator.java
+4
-3
No files found.
dlink-core/src/main/java/com/dlink/explainer/ca/ColumnCAGenerator.java
View file @
c2d72cda
package
com
.
dlink
.
explainer
.
ca
;
import
com.dlink.assertion.Asserts
;
import
com.dlink.explainer.trans.Field
;
import
com.dlink.explainer.trans.OperatorTrans
;
import
com.dlink.explainer.trans.SinkTrans
;
...
...
@@ -91,22 +92,22 @@ public class ColumnCAGenerator implements CAGenerator {
sufOnly
.
add
(
nodeRel
.
getSufId
());
}
}
/*
for (NodeRel nodeRel : this.columnCASRel) {
for
(
NodeRel
nodeRel
:
this
.
columnCASRel
)
{
if
(
sufOnly
.
contains
(
nodeRel
.
getPreId
()))
{
sufOnly
.
remove
(
nodeRel
.
getPreId
());
}
}
*/
}
List
<
Integer
>
preOnly
=
new
ArrayList
<>();
for
(
NodeRel
nodeRel
:
this
.
columnCASRel
)
{
if
(!
preOnly
.
contains
(
nodeRel
.
getPreId
()))
{
preOnly
.
add
(
nodeRel
.
getPreId
());
}
}
/*
for (NodeRel nodeRel : this.columnCASRel) {
for
(
NodeRel
nodeRel
:
this
.
columnCASRel
)
{
if
(
preOnly
.
contains
(
nodeRel
.
getSufId
()))
{
preOnly
.
remove
(
nodeRel
.
getSufId
());
}
}
*/
}
for
(
int
i
=
0
;
i
<
sufOnly
.
size
();
i
++)
{
ColumnCA
columnCA
=
(
ColumnCA
)
this
.
columnCASMaps
.
get
(
sufOnly
.
get
(
i
));
List
<
String
>
fields
=
tableCA
.
getFields
();
...
...
@@ -136,7 +137,7 @@ public class ColumnCAGenerator implements CAGenerator {
if
(
transMaps
.
get
(
id
)
instanceof
OperatorTrans
)
{
OperatorTrans
trans
=
(
OperatorTrans
)
transMaps
.
get
(
id
);
List
<
Field
>
selects
=
trans
.
getSelect
();
if
(
selects
!=
null
&&
selects
.
size
()
>
0
)
{
if
(
Asserts
.
isNotNull
(
selects
)
)
{
for
(
int
i
=
0
;
i
<
selects
.
size
();
i
++)
{
String
operation
=
selects
.
get
(
i
).
getFragment
();
String
alias
=
selects
.
get
(
i
).
getAlias
();
...
...
@@ -150,7 +151,7 @@ public class ColumnCAGenerator implements CAGenerator {
}
private
void
searchSelect
(
TableCA
tableCA
,
ColumnCA
columnCA
,
OperatorTrans
trans
,
String
operation
,
String
alias
)
{
if
(
operation
.
contains
(
" "
+
columnCA
.
getAlias
()
+
" "
)
||
if
(
Asserts
.
isEquals
(
operation
,
columnCA
.
getAlias
())||
operation
.
contains
(
" "
+
columnCA
.
getAlias
()
+
" "
)
||
operation
.
contains
(
"("
+
columnCA
.
getAlias
()
+
" "
)
||
operation
.
contains
(
" "
+
columnCA
.
getAlias
()
+
")"
))
{
boolean
isHad
=
false
;
...
...
dlink-core/src/main/java/com/dlink/explainer/ca/TableCAGenerator.java
View file @
c2d72cda
package
com
.
dlink
.
explainer
.
ca
;
import
com.dlink.assertion.Asserts
;
import
com.dlink.explainer.trans.Field
;
import
com.dlink.explainer.trans.OperatorTrans
;
import
com.dlink.explainer.trans.SinkTrans
;
...
...
@@ -89,14 +90,14 @@ public class TableCAGenerator implements CAGenerator {
OperatorTrans
trans
=
(
OperatorTrans
)
transMaps
.
get
(
id
);
searchSelectFields
(
tableCA
,
trans
.
getSelect
(),
field
);
searchWhereFields
(
tableCA
,
trans
.
getWhere
(),
field
);
if
(
trans
.
getParentId
()!=
null
){
if
(
Asserts
.
isNotNull
(
trans
.
getParentId
())
){
buildTableCAFields
(
tableCA
,
trans
.
getParentId
(),
field
);
}
}
}
private
void
searchSelectFields
(
TableCA
tableCA
,
List
<
Field
>
selects
,
String
field
){
if
(
selects
!=
null
&&
selects
.
size
()>
0
){
if
(
Asserts
.
isNotNull
(
selects
)
){
for
(
int
i
=
0
;
i
<
selects
.
size
();
i
++){
List
<
String
>
fields
=
matchFields
(
selects
.
get
(
i
).
getFragment
(),
field
);
/*if(tableCA.getFields().contains(field)){
...
...
@@ -112,7 +113,7 @@ public class TableCAGenerator implements CAGenerator {
}
private
void
searchWhereFields
(
TableCA
tableCA
,
String
wheres
,
String
field
){
if
(
wheres
!=
null
&&!
"[]"
.
equals
(
wheres
)){
if
(
Asserts
.
isNotNull
(
wheres
)
&&!
"[]"
.
equals
(
wheres
)){
List
<
String
>
fields
=
matchFields
(
wheres
,
field
);
/*if(tableCA.getFields().contains(field)){
tableCA.getFields().remove(field);
...
...
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