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
eb98bfe7
Commit
eb98bfe7
authored
8 years ago
by
Suma Shivaprasad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1122 Change trait edge labels to have trait name alone (sumasai)
parent
6fddccd6
master
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
29 deletions
+34
-29
release-log.txt
release-log.txt
+1
-0
GraphHelper.java
...n/java/org/apache/atlas/repository/graph/GraphHelper.java
+1
-1
GraphPersistenceStrategies.scala
...a/org/apache/atlas/query/GraphPersistenceStrategies.scala
+1
-1
GraphBackedMetadataRepositoryTest.java
...s/repository/graph/GraphBackedMetadataRepositoryTest.java
+30
-26
HiveTitanSample.scala
...c/test/scala/org/apache/atlas/query/HiveTitanSample.scala
+1
-1
No files found.
release-log.txt
View file @
eb98bfe7
...
...
@@ -6,6 +6,7 @@ INCOMPATIBLE CHANGES:
ATLAS-1060 Add composite indexes for exact match performance improvements for all attributes (sumasai via shwethags)
ALL CHANGES:
ATLAS-1122 Change trait edge labels to have trait name alone (sumasai)
ATLAS-1121 NPE while submitting topology in StormHook (ayubkhan via sumasai)
ATLAS-1119 Add retries for edge label creation (sumasai via shwethags)
ATLAS-1111 Data loss is observed when atlas is restarted while hive_table metadata ingestion into kafka topic is in-progress(shwethags via sumasai)
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
View file @
eb98bfe7
...
...
@@ -433,7 +433,7 @@ public final class GraphHelper {
}
public
static
String
getTraitLabel
(
String
typeName
,
String
attrName
)
{
return
typeName
+
"."
+
attrName
;
return
attrName
;
}
public
static
List
<
String
>
getTraitNames
(
Vertex
entityVertex
)
{
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/scala/org/apache/atlas/query/GraphPersistenceStrategies.scala
View file @
eb98bfe7
...
...
@@ -203,7 +203,7 @@ object GraphPersistenceStrategy1 extends GraphPersistenceStrategies {
val
fieldPrefixInSelect
=
"it"
def
traitLabel
(
cls
:
IDataType
[
_
],
traitName
:
String
)
=
s
"$
{cls.getName}.$
traitName"
def
traitLabel
(
cls
:
IDataType
[
_
],
traitName
:
String
)
=
s
"$traitName"
def
fieldNameInVertex
(
dataType
:
IDataType
[
_
],
aInfo
:
AttributeInfo
)
=
GraphHelper
.
getQualifiedFieldName
(
dataType
,
aInfo
.
name
)
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryTest.java
View file @
eb98bfe7
...
...
@@ -43,6 +43,7 @@ import org.apache.atlas.typesystem.Struct;
import
org.apache.atlas.typesystem.exception.EntityNotFoundException
;
import
org.apache.atlas.typesystem.exception.TraitNotFoundException
;
import
org.apache.atlas.typesystem.persistence.Id
;
import
org.apache.atlas.typesystem.types.AttributeDefinition
;
import
org.apache.atlas.typesystem.types.ClassType
;
import
org.apache.atlas.typesystem.types.DataTypes
;
import
org.apache.atlas.typesystem.types.HierarchicalTypeDefinition
;
...
...
@@ -77,6 +78,7 @@ import static org.apache.atlas.typesystem.types.utils.TypesUtil.createClassTypeD
import
static
org
.
apache
.
atlas
.
typesystem
.
types
.
utils
.
TypesUtil
.
createUniqueRequiredAttrDef
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNotEquals
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
/**
...
...
@@ -136,31 +138,35 @@ public class GraphBackedMetadataRepositoryTest {
@Test
//In some cases of parallel APIs, the edge is added, but get edge by label doesn't return the edge. ATLAS-1104
public
void
testConcurrentCalls
()
throws
Exception
{
Referenceable
dbInstance
=
new
Referenceable
(
TestUtils
.
DATABASE_TYPE
);
dbInstance
.
set
(
"name"
,
randomString
());
dbInstance
.
set
(
"description"
,
"foo database"
);
final
String
id1
=
createEntity
(
dbInstance
).
get
(
0
);
final
HierarchicalTypeDefinition
<
ClassType
>
refType
=
createClassTypeDef
(
randomString
(),
ImmutableSet
.<
String
>
of
());
HierarchicalTypeDefinition
<
ClassType
>
type
=
createClassTypeDef
(
randomString
(),
ImmutableSet
.<
String
>
of
(),
new
AttributeDefinition
(
"ref"
,
refType
.
typeName
,
Multiplicity
.
OPTIONAL
,
true
,
null
));
typeSystem
.
defineClassType
(
refType
);
typeSystem
.
defineClassType
(
type
);
String
refId1
=
createEntity
(
new
Referenceable
(
refType
.
typeName
)).
get
(
0
);
String
refId2
=
createEntity
(
new
Referenceable
(
refType
.
typeName
)).
get
(
0
);
dbInstance
.
set
(
"name"
,
randomString
()
);
final
String
id2
=
createEntity
(
dbInstance
).
get
(
0
);
final
Referenceable
instance1
=
new
Referenceable
(
type
.
typeName
);
instance1
.
set
(
"ref"
,
new
Referenceable
(
refId1
,
refType
.
typeName
,
null
)
);
TraitType
piiType
=
typeSystem
.
getDataType
(
TraitType
.
class
,
TestUtils
.
PII
);
final
ITypedStruct
trait
=
piiType
.
convert
(
new
Struct
(
TestUtils
.
PII
),
Multiplicity
.
REQUIRED
);
final
Referenceable
instance2
=
new
Referenceable
(
type
.
typeName
);
instance2
.
set
(
"ref"
,
new
Referenceable
(
refId2
,
refType
.
typeName
,
null
)
);
ExecutorService
executor
=
Executors
.
newFixedThreadPool
(
3
);
List
<
Future
<
Object
>>
futures
=
new
ArrayList
<>();
futures
.
add
(
executor
.
submit
(
new
Callable
<
Object
>()
{
@Override
public
Object
call
()
throws
Exception
{
repositoryService
.
addTrait
(
id1
,
trait
);
return
null
;
return
createEntity
(
instance1
).
get
(
0
);
}
}));
futures
.
add
(
executor
.
submit
(
new
Callable
<
Object
>()
{
@Override
public
Object
call
()
throws
Exception
{
repositoryService
.
addTrait
(
id2
,
trait
);
return
null
;
return
createEntity
(
instance2
).
get
(
0
);
}
}));
futures
.
add
(
executor
.
submit
(
new
Callable
<
Object
>()
{
...
...
@@ -170,25 +176,23 @@ public class GraphBackedMetadataRepositoryTest {
}
}));
for
(
Future
future
:
futures
)
{
future
.
get
();
}
String
id1
=
(
String
)
futures
.
get
(
0
).
get
();
String
id2
=
(
String
)
futures
.
get
(
1
)
.
get
();
futures
.
get
(
2
).
get
();
executor
.
shutdown
();
boolean
validated1
=
assertEdge
(
id1
);
boolean
validated2
=
assertEdge
(
id2
);
assert
NotEquals
(
validated1
,
validated2
);
boolean
validated1
=
assertEdge
(
id1
,
type
.
typeName
);
boolean
validated2
=
assertEdge
(
id2
,
type
.
typeName
);
assert
True
(
validated1
|
validated2
);
}
private
boolean
assertEdge
(
String
id
)
throws
Exception
{
private
boolean
assertEdge
(
String
id
,
String
typeName
)
throws
Exception
{
TitanGraph
graph
=
graphProvider
.
get
();
Vertex
vertex
=
graph
.
query
().
has
(
Constants
.
GUID_PROPERTY_KEY
,
id
).
vertices
().
iterator
().
next
();
Iterable
<
Edge
>
edges
=
vertex
.
getEdges
(
Direction
.
OUT
,
TestUtils
.
DATABASE_TYPE
+
"."
+
TestUtils
.
PII
);
if
(!
edges
.
iterator
().
hasNext
())
{
repositoryService
.
deleteTrait
(
id
,
TestUtils
.
PII
);
List
<
String
>
traits
=
repositoryService
.
getTraitNames
(
id
);
assertTrue
(
traits
.
isEmpty
());
Iterable
<
Edge
>
edges
=
vertex
.
getEdges
(
Direction
.
OUT
,
Constants
.
INTERNAL_PROPERTY_KEY_PREFIX
+
typeName
+
".ref"
);
if
(!
edges
.
iterator
().
hasNext
())
{
ITypedReferenceableInstance
entity
=
repositoryService
.
getEntityDefinition
(
id
);
assertNotNull
(
entity
.
get
(
"ref"
));
return
true
;
}
return
false
;
...
...
@@ -237,7 +241,7 @@ public class GraphBackedMetadataRepositoryTest {
public
void
testGetTraitLabel
()
throws
Exception
{
Assert
.
assertEquals
(
repositoryService
.
getTraitLabel
(
typeSystem
.
getDataType
(
ClassType
.
class
,
TestUtils
.
TABLE_TYPE
),
TestUtils
.
CLASSIFICATION
),
TestUtils
.
TABLE_TYPE
+
"."
+
TestUtils
.
CLASSIFICATION
);
TestUtils
.
CLASSIFICATION
),
TestUtils
.
CLASSIFICATION
);
}
@Test
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/scala/org/apache/atlas/query/HiveTitanSample.scala
View file @
eb98bfe7
...
...
@@ -125,7 +125,7 @@ object HiveTitanSample {
if
(
traits
.
isDefined
)
{
traits
.
get
foreach
{
t
=>
t
.
toGSon
(
vertices
,
edges
)
addEdge
(
t
,
s
"${t
his.getClass.getSimpleName}.${t
.getClass.getSimpleName}"
,
edges
)
addEdge
(
t
,
s
"${t.getClass.getSimpleName}"
,
edges
)
}
}
}
...
...
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