Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
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
dataplatform
atlas
Commits
aaf0ba23
Commit
aaf0ba23
authored
6 years ago
by
Madhan Neethiraj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3187: columns attribute is empty for deleted hive_table entity
parent
ed288a75
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
23 deletions
+41
-23
EntityGraphRetriever.java
...atlas/repository/store/graph/v2/EntityGraphRetriever.java
+41
-23
No files found.
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
View file @
aaf0ba23
...
...
@@ -72,7 +72,6 @@ import java.util.HashMap;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.ListIterator
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Set
;
...
...
@@ -85,7 +84,7 @@ import static org.apache.atlas.glossary.GlossaryUtils.TERM_ASSIGNMENT_ATTR_EXPRE
import
static
org
.
apache
.
atlas
.
glossary
.
GlossaryUtils
.
TERM_ASSIGNMENT_ATTR_SOURCE
;
import
static
org
.
apache
.
atlas
.
glossary
.
GlossaryUtils
.
TERM_ASSIGNMENT_ATTR_STATUS
;
import
static
org
.
apache
.
atlas
.
glossary
.
GlossaryUtils
.
TERM_ASSIGNMENT_ATTR_STEWARD
;
import
static
org
.
apache
.
atlas
.
model
.
instance
.
AtlasRelationship
.
Status
.
ACTIVE
;
import
static
org
.
apache
.
atlas
.
model
.
instance
.
AtlasRelationship
.
Status
.
DELETED
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasBaseTypeDef
.
ATLAS_TYPE_BIGDECIMAL
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasBaseTypeDef
.
ATLAS_TYPE_BIGINTEGER
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasBaseTypeDef
.
ATLAS_TYPE_BOOLEAN
;
...
...
@@ -101,12 +100,9 @@ import static org.apache.atlas.repository.Constants.CLASSIFICATION_ENTITY_GUID;
import
static
org
.
apache
.
atlas
.
repository
.
Constants
.
CLASSIFICATION_LABEL
;
import
static
org
.
apache
.
atlas
.
repository
.
Constants
.
CLASSIFICATION_VALIDITY_PERIODS_KEY
;
import
static
org
.
apache
.
atlas
.
repository
.
Constants
.
TERM_ASSIGNMENT_LABEL
;
import
static
org
.
apache
.
atlas
.
repository
.
graph
.
GraphHelper
.
EDGE_LABEL_PREFIX
;
import
static
org
.
apache
.
atlas
.
repository
.
graph
.
GraphHelper
.
addToPropagatedTraitNames
;
import
static
org
.
apache
.
atlas
.
repository
.
graph
.
GraphHelper
.
getAdjacentEdgesByLabel
;
import
static
org
.
apache
.
atlas
.
repository
.
graph
.
GraphHelper
.
getAllClassificationEdges
;
import
static
org
.
apache
.
atlas
.
repository
.
graph
.
GraphHelper
.
getAllTraitNames
;
import
static
org
.
apache
.
atlas
.
repository
.
graph
.
GraphHelper
.
getAssociatedEntityVertex
;
import
static
org
.
apache
.
atlas
.
repository
.
graph
.
GraphHelper
.
getBlockedClassificationIds
;
import
static
org
.
apache
.
atlas
.
repository
.
graph
.
GraphHelper
.
getArrayElementsProperty
;
import
static
org
.
apache
.
atlas
.
repository
.
graph
.
GraphHelper
.
getClassificationEntityStatus
;
...
...
@@ -1108,42 +1104,64 @@ public class EntityGraphRetriever {
entity
.
setRelationshipAttribute
(
attributeName
,
ret
);
if
(
attributeEndDef
.
getIsLegacyAttribute
()
&&
!
entity
.
hasAttribute
(
attributeName
))
{
entity
.
setAttribute
(
attributeName
,
to
AtlasObjectId
(
ret
));
entity
.
setAttribute
(
attributeName
,
to
LegacyAttribute
(
ret
));
}
}
return
ret
;
}
private
Object
to
AtlasObjectId
(
Object
obj
)
{
private
Object
to
LegacyAttribute
(
Object
obj
)
{
final
Object
ret
;
if
(
obj
instanceof
AtlasRelatedObjectId
)
{
AtlasRelatedObjectId
relatedObjId
=
(
AtlasRelatedObjectId
)
obj
;
ret
=
relatedObjId
.
getRelationshipStatus
()
==
ACTIVE
?
new
AtlasObjectId
((
AtlasObjectId
)
obj
)
:
null
;
ret
=
toLegacyAttribute
((
AtlasRelatedObjectId
)
obj
);
}
else
if
(
obj
instanceof
Collection
)
{
List
list
=
new
ArrayList
();
ret
=
toLegacyAttribute
((
Collection
)
obj
);
}
else
if
(
obj
instanceof
Map
)
{
ret
=
toLegacyAttribute
((
Map
)
obj
);
}
else
{
ret
=
obj
;
}
return
ret
;
}
for
(
Object
elem
:
(
Collection
)
obj
)
{
Object
objId
=
toAtlasObjectId
(
elem
)
;
private
AtlasObjectId
toLegacyAttribute
(
AtlasRelatedObjectId
relatedObjId
)
{
final
AtlasObjectId
ret
;
if
(
objId
!=
null
)
{
list
.
add
(
objId
);
if
(
relatedObjId
.
getRelationshipStatus
()
==
DELETED
&&
relatedObjId
.
getEntityStatus
()
==
AtlasEntity
.
Status
.
ACTIVE
)
{
ret
=
null
;
}
else
{
ret
=
new
AtlasObjectId
(
relatedObjId
);
}
return
ret
;
}
ret
=
list
;
}
else
if
(
obj
instanceof
Map
)
{
Map
map
=
new
HashMap
();
private
Collection
toLegacyAttribute
(
Collection
collection
)
{
final
List
ret
=
new
ArrayList
();
for
(
Object
elem
:
collection
)
{
Object
objId
=
toLegacyAttribute
(
elem
);
for
(
Object
key
:
((
Map
)
obj
).
keySet
())
{
map
.
put
(
key
,
toAtlasObjectId
(((
Map
)
obj
).
get
(
key
)));
if
(
objId
!=
null
)
{
ret
.
add
(
objId
);
}
}
ret
=
map
;
}
else
{
ret
=
obj
;
return
ret
;
}
private
Map
toLegacyAttribute
(
Map
map
)
{
final
Map
ret
=
new
HashMap
();
for
(
Object
key
:
map
.
keySet
())
{
Object
elem
=
toLegacyAttribute
(
map
.
get
(
key
));
if
(
elem
!=
null
)
{
ret
.
put
(
key
,
elem
);
}
}
return
ret
;
...
...
This diff is collapsed.
Click to expand it.
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