Skip to content

Commit 87332ab

Browse files
chaitalicodchaitalithombare
andauthored
ATLAS-4974: impala-bridge, impala-bridge-shim, impala-hook-api module… (#385)
* ATLAS-4974: impala-bridge, impala-bridge-shim, impala-hook-api modules: update for code readability improvements * ATLAS-4974: impala-bridge, impala-bridge-shim, impala-hook-api modules: update for code readability improvements --------- Co-authored-by: chaitalithombare <[email protected]>
1 parent d285ddb commit 87332ab

File tree

8 files changed

+202
-170
lines changed

8 files changed

+202
-170
lines changed

addons/impala-bridge-shim/src/main/java/org/apache/atlas/impala/hook/ImpalaLineageHook.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ public class ImpalaLineageHook implements QueryEventHook {
3333

3434
private static final String ATLAS_PLUGIN_TYPE_IMPALA = "impala";
3535
private static final String ATLAS_IMPALA_LINEAGE_HOOK_IMPL_CLASSNAME =
36-
"org.apache.atlas.impala.hook.ImpalaHook";
36+
"org.apache.atlas.impala.hook.ImpalaHook";
3737

38-
private AtlasPluginClassLoader atlasPluginClassLoader = null;
38+
private AtlasPluginClassLoader atlasPluginClassLoader;
3939
private QueryEventHook impalaLineageHookImpl;
4040

4141
public ImpalaLineageHook() {
@@ -71,7 +71,7 @@ public void onImpalaStartup() {
7171

7272
@SuppressWarnings("unchecked")
7373
Class<QueryEventHook> cls = (Class<QueryEventHook>) Class
74-
.forName(ATLAS_IMPALA_LINEAGE_HOOK_IMPL_CLASSNAME, true, atlasPluginClassLoader);
74+
.forName(ATLAS_IMPALA_LINEAGE_HOOK_IMPL_CLASSNAME, true, atlasPluginClassLoader);
7575

7676
activatePluginClassLoader();
7777

@@ -97,4 +97,4 @@ private void deactivatePluginClassLoader() {
9797
atlasPluginClassLoader.deactivate();
9898
}
9999
}
100-
}
100+
}

addons/impala-bridge/src/main/java/org/apache/atlas/impala/model/ImpalaNode.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,21 @@ public ImpalaNode(LineageVertex ownVertex) {
3333
children = new HashMap<>();
3434
}
3535

36-
public String getNodeName() { return ownVertex.getVertexId(); }
37-
public ImpalaVertexType getNodeType() { return ownVertex.getVertexType(); }
38-
public LineageVertex getOwnVertex() { return ownVertex; }
39-
public Map<Long, ImpalaNode> getChildren() { return children; }
36+
public String getNodeName() {
37+
return ownVertex.getVertexId();
38+
}
39+
40+
public ImpalaVertexType getNodeType() {
41+
return ownVertex.getVertexType();
42+
}
43+
44+
public LineageVertex getOwnVertex() {
45+
return ownVertex;
46+
}
47+
48+
public Map<Long, ImpalaNode> getChildren() {
49+
return children;
50+
}
4051

4152
/**
4253
* Add child to this node

addons/impala-bridge/src/main/java/org/apache/atlas/impala/model/ImpalaOperationType.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@
1717
*/
1818
package org.apache.atlas.impala.model;
1919

20-
public enum ImpalaOperationType{
20+
public enum ImpalaOperationType {
2121
// main operation type
22-
CREATEVIEW ("CREATEVIEW"),
23-
CREATETABLE_AS_SELECT ("CREATETABLE_AS_SELECT"),
24-
ALTERVIEW_AS ("ALTERVIEW_AS"),
25-
QUERY ("QUERY"),
26-
QUERY_WITH_CLAUSE ("QUERY_WITH_CLAUSE"),
22+
CREATEVIEW("CREATEVIEW"),
23+
CREATETABLE_AS_SELECT("CREATETABLE_AS_SELECT"),
24+
ALTERVIEW_AS("ALTERVIEW_AS"),
25+
QUERY("QUERY"),
26+
QUERY_WITH_CLAUSE("QUERY_WITH_CLAUSE"),
2727

2828
// sub operation type, which is associated with output
29-
INSERT ("INSERT"),
30-
INSERT_OVERWRITE ("INSERT_OVERWRITE"),
29+
INSERT("INSERT"),
30+
INSERT_OVERWRITE("INSERT_OVERWRITE"),
3131

3232
// default type
33-
UNKNOWN ("UNKNOWN");
33+
UNKNOWN("UNKNOWN");
3434

3535
private final String name;
3636

@@ -45,4 +45,4 @@ public boolean equalsName(String otherName) {
4545
public String toString() {
4646
return this.name;
4747
}
48-
}
48+
}

addons/impala-bridge/src/main/java/org/apache/atlas/impala/model/ImpalaQuery.java

Lines changed: 79 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -18,93 +18,95 @@
1818

1919
package org.apache.atlas.impala.model;
2020

21-
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
22-
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
23-
2421
import com.fasterxml.jackson.annotation.JsonAutoDetect;
2522
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
2623
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
24+
2725
import java.util.List;
2826

27+
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
28+
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
29+
2930
/**
3031
* Represent an Impala lineage record in lineage log.
3132
*/
32-
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
33-
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
34-
@JsonIgnoreProperties(ignoreUnknown=true)
33+
@JsonAutoDetect(getterVisibility = PUBLIC_ONLY, setterVisibility = PUBLIC_ONLY, fieldVisibility = NONE)
34+
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
35+
@JsonIgnoreProperties(ignoreUnknown = true)
3536
public class ImpalaQuery {
36-
private String queryText;
37-
private String queryId;
38-
private String hash;
39-
private String user;
37+
private String queryText;
38+
private String queryId;
39+
private String hash;
40+
private String user;
4041

4142
// the time stamp is in seconds. It is Unix epoch, which is the number of seconds that have
4243
// elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds
43-
private Long timestamp;
44-
private Long endTime;
45-
private List<LineageEdge> edges;
46-
private List<LineageVertex> vertices;
47-
48-
public List<LineageEdge> getEdges() {
49-
return edges;
50-
}
51-
52-
public List<LineageVertex> getVertices() {
53-
return vertices;
54-
}
55-
56-
public Long getEndTime() {
57-
return endTime;
58-
}
59-
60-
public String getHash() {
61-
return hash;
62-
}
63-
64-
public String getQueryId() {
65-
return queryId;
66-
}
67-
68-
public String getQueryText() {
69-
return queryText;
70-
}
71-
72-
public Long getTimestamp() {
73-
return timestamp;
74-
}
75-
76-
public String getUser() {
77-
return user;
78-
}
79-
80-
public void setEdges(List<LineageEdge> edges) {
81-
this.edges = edges;
82-
}
83-
84-
public void setEndTime(Long endTime) {
85-
this.endTime = endTime;
86-
}
87-
88-
public void setHash(String hash) {
89-
this.hash = hash;
90-
}
91-
92-
public void setQueryId(String queryId) {
93-
this.queryId = queryId;
94-
}
95-
96-
public void setQueryText(String queryText) {
97-
this.queryText = queryText;
98-
}
99-
100-
public void setTimestamp(Long timestamp) { this.timestamp = timestamp; }
101-
102-
public void setUser(String user) {
103-
this.user = user;
104-
}
105-
106-
public void setVertices(List<LineageVertex> vertices) {
107-
this.vertices = vertices;
108-
}
109-
44+
private Long timestamp;
45+
private Long endTime;
46+
private List<LineageEdge> edges;
47+
private List<LineageVertex> vertices;
48+
49+
public List<LineageEdge> getEdges() {
50+
return edges;
51+
}
52+
53+
public List<LineageVertex> getVertices() {
54+
return vertices;
55+
}
56+
57+
public Long getEndTime() {
58+
return endTime;
59+
}
60+
61+
public String getHash() {
62+
return hash;
63+
}
64+
65+
public String getQueryId() {
66+
return queryId;
67+
}
68+
69+
public String getQueryText() {
70+
return queryText;
71+
}
72+
73+
public Long getTimestamp() {
74+
return timestamp;
75+
}
76+
77+
public String getUser() {
78+
return user;
79+
}
80+
81+
public void setEdges(List<LineageEdge> edges) {
82+
this.edges = edges;
83+
}
84+
85+
public void setEndTime(Long endTime) {
86+
this.endTime = endTime;
87+
}
88+
89+
public void setHash(String hash) {
90+
this.hash = hash;
91+
}
92+
93+
public void setQueryId(String queryId) {
94+
this.queryId = queryId;
95+
}
96+
97+
public void setQueryText(String queryText) {
98+
this.queryText = queryText;
99+
}
100+
101+
public void setTimestamp(Long timestamp) {
102+
this.timestamp = timestamp;
103+
}
104+
105+
public void setUser(String user) {
106+
this.user = user;
107+
}
108+
109+
public void setVertices(List<LineageVertex> vertices) {
110+
this.vertices = vertices;
111+
}
110112
}

addons/impala-bridge/src/main/java/org/apache/atlas/impala/model/LineageEdge.java

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,46 +18,47 @@
1818

1919
package org.apache.atlas.impala.model;
2020

21-
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
22-
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
23-
2421
import com.fasterxml.jackson.annotation.JsonAutoDetect;
2522
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
2623
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
24+
2725
import java.util.List;
2826

27+
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
28+
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
29+
2930
/**
3031
* This represents an edge in Impala's lineage record that connects two entities
3132
*/
32-
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
33-
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
34-
@JsonIgnoreProperties(ignoreUnknown=true)
33+
@JsonAutoDetect(getterVisibility = PUBLIC_ONLY, setterVisibility = PUBLIC_ONLY, fieldVisibility = NONE)
34+
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
35+
@JsonIgnoreProperties(ignoreUnknown = true)
3536
public class LineageEdge {
36-
private List<Long> sources;
37-
private List<Long> targets;
38-
private ImpalaDependencyType edgeType;
37+
private List<Long> sources;
38+
private List<Long> targets;
39+
private ImpalaDependencyType edgeType;
3940

40-
public List<Long> getSources() {
41-
return sources;
42-
}
41+
public List<Long> getSources() {
42+
return sources;
43+
}
4344

44-
public List<Long> getTargets() {
45-
return targets;
46-
}
45+
public List<Long> getTargets() {
46+
return targets;
47+
}
4748

48-
public ImpalaDependencyType getEdgeType() {
49-
return edgeType;
50-
}
49+
public ImpalaDependencyType getEdgeType() {
50+
return edgeType;
51+
}
5152

52-
public void setSources(List<Long> sources) {
53-
this.sources = sources;
54-
}
53+
public void setSources(List<Long> sources) {
54+
this.sources = sources;
55+
}
5556

56-
public void setTargets(List<Long> targets) {
57-
this.targets = targets;
58-
}
57+
public void setTargets(List<Long> targets) {
58+
this.targets = targets;
59+
}
5960

60-
public void setEdgeType(ImpalaDependencyType edgeType) {
61-
this.edgeType = edgeType;
62-
}
61+
public void setEdgeType(ImpalaDependencyType edgeType) {
62+
this.edgeType = edgeType;
63+
}
6364
}

0 commit comments

Comments
 (0)