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
bf377abb
Commit
bf377abb
authored
8 years ago
by
Sarath Subramanian
Committed by
Madhan Neethiraj
8 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1403: Perf and stability improvements to DSL search and lineage query execution
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
c9c26d74
master
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
125 additions
and
76 deletions
+125
-76
release-log.txt
release-log.txt
+1
-0
DataSetLineageService.java
...ava/org/apache/atlas/discovery/DataSetLineageService.java
+2
-2
DefaultGraphPersistenceStrategy.java
...tlas/discovery/graph/DefaultGraphPersistenceStrategy.java
+9
-7
GraphBackedDiscoveryService.java
...he/atlas/discovery/graph/GraphBackedDiscoveryService.java
+23
-16
Gremlin2ExpressionFactory.java
...a/org/apache/atlas/gremlin/Gremlin2ExpressionFactory.java
+8
-6
GremlinExpressionFactory.java
...va/org/apache/atlas/gremlin/GremlinExpressionFactory.java
+40
-9
GraphHelper.java
...n/java/org/apache/atlas/repository/graph/GraphHelper.java
+8
-0
ClosureQuery.scala
.../src/main/scala/org/apache/atlas/query/ClosureQuery.scala
+2
-5
GraphPersistenceStrategies.scala
...a/org/apache/atlas/query/GraphPersistenceStrategies.scala
+1
-0
GremlinEvaluator.scala
.../main/scala/org/apache/atlas/query/GremlinEvaluator.scala
+4
-8
GremlinQuery.scala
.../src/main/scala/org/apache/atlas/query/GremlinQuery.scala
+3
-2
DataSetLineageServiceTest.java
...org/apache/atlas/discovery/DataSetLineageServiceTest.java
+16
-17
GremlinTest2.scala
.../src/test/scala/org/apache/atlas/query/GremlinTest2.scala
+8
-4
No files found.
release-log.txt
View file @
bf377abb
...
...
@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES:
ATLAS-1403 Perf and stability improvements to DSL search and lineage query execution (sarath.kum4r@gmail.com via mneethiraj)
ATLAS-1425 Integrate Discovery/Search API in Atlas UI (kevalbhatt via mneethiraj)
ATLAS-1482 UI update in assigning a tag to multiple entities using single API call (kevalbhatt via mneethiraj)
ATLAS-1486 UI updates to handle errors from V2 APIs (Kalyanikashikar via mneethiraj)
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/discovery/DataSetLineageService.java
View file @
bf377abb
...
...
@@ -139,7 +139,7 @@ public class DataSetLineageService implements LineageService {
guid
,
HIVE_PROCESS_TYPE_NAME
,
HIVE_PROCESS_INPUT_ATTRIBUTE_NAME
,
HIVE_PROCESS_OUTPUT_ATTRIBUTE_NAME
,
Option
.
empty
(),
SELECT_ATTRIBUTES
,
true
,
graphPersistenceStrategy
,
graph
);
return
inputsQuery
.
graph
().
toInstanceJson
();
return
inputsQuery
.
graph
(
null
).
toInstanceJson
();
}
@Override
...
...
@@ -156,7 +156,7 @@ public class DataSetLineageService implements LineageService {
new
OutputLineageClosureQuery
(
AtlasClient
.
DATA_SET_SUPER_TYPE
,
SELECT_INSTANCE_GUID
,
guid
,
HIVE_PROCESS_TYPE_NAME
,
HIVE_PROCESS_INPUT_ATTRIBUTE_NAME
,
HIVE_PROCESS_OUTPUT_ATTRIBUTE_NAME
,
Option
.
empty
(),
SELECT_ATTRIBUTES
,
true
,
graphPersistenceStrategy
,
graph
);
return
outputsQuery
.
graph
().
toInstanceJson
();
return
outputsQuery
.
graph
(
null
).
toInstanceJson
();
}
/**
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/discovery/graph/DefaultGraphPersistenceStrategy.java
View file @
bf377abb
...
...
@@ -18,10 +18,8 @@
package
org
.
apache
.
atlas
.
discovery
.
graph
;
import
java.util.List
;
import
javax.inject.Inject
;
import
com.google.common.collect.ImmutableCollection
;
import
com.google.common.collect.ImmutableList
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.groovy.GroovyExpression
;
import
org.apache.atlas.query.GraphPersistenceStrategies
;
...
...
@@ -36,7 +34,6 @@ import org.apache.atlas.repository.graphdb.AtlasEdgeDirection;
import
org.apache.atlas.repository.graphdb.AtlasGraph
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.graphdb.GremlinVersion
;
import
org.apache.atlas.typesystem.IReferenceableInstance
;
import
org.apache.atlas.typesystem.ITypedReferenceableInstance
;
import
org.apache.atlas.typesystem.ITypedStruct
;
import
org.apache.atlas.typesystem.persistence.Id
;
...
...
@@ -51,8 +48,8 @@ import org.apache.atlas.typesystem.types.TypeSystem;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
com.google.common.collect.ImmutableCollection
;
import
com.google.common.collect.Immutable
List
;
import
javax.inject.Inject
;
import
java.util.
List
;
/**
* Default implementation of GraphPersistenceStrategy.
...
...
@@ -252,6 +249,11 @@ public class DefaultGraphPersistenceStrategy implements GraphPersistenceStrategi
}
@Override
public
boolean
filterBySubTypes
()
{
return
GraphPersistenceStrategies$class
.
filterBySubTypes
(
this
);
}
@Override
public
boolean
addGraphVertexPrefix
(
scala
.
collection
.
Traversable
<
GroovyExpression
>
preStatements
)
{
return
GraphPersistenceStrategies$class
.
addGraphVertexPrefix
(
this
,
preStatements
);
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/discovery/graph/GraphBackedDiscoveryService.java
View file @
bf377abb
...
...
@@ -18,16 +18,6 @@
package
org
.
apache
.
atlas
.
discovery
.
graph
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
javax.inject.Inject
;
import
javax.inject.Singleton
;
import
javax.script.ScriptException
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.GraphTransaction
;
import
org.apache.atlas.discovery.DiscoveryException
;
...
...
@@ -53,10 +43,19 @@ import org.codehaus.jettison.json.JSONException;
import
org.codehaus.jettison.json.JSONObject
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
scala.util.Either
;
import
scala.util.parsing.combinator.Parsers
;
import
javax.inject.Inject
;
import
javax.inject.Singleton
;
import
javax.script.ScriptException
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
/**
* Graph backed implementation of Search.
*/
...
...
@@ -125,7 +124,11 @@ public class GraphBackedDiscoveryService implements DiscoveryService {
}
public
GremlinQueryResult
evaluate
(
String
dslQuery
,
QueryParams
queryParams
)
throws
DiscoveryException
{
LOG
.
debug
(
"Executing dsl query={}"
,
dslQuery
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"Executing dsl query={}"
,
dslQuery
);
}
try
{
Either
<
Parsers
.
NoSuccess
,
Expressions
.
Expression
>
either
=
QueryParser
.
apply
(
dslQuery
,
queryParams
);
if
(
either
.
isRight
())
{
...
...
@@ -145,13 +148,17 @@ public class GraphBackedDiscoveryService implements DiscoveryService {
//If the final limit is 0, don't launch the query, return with 0 rows
if
(
validatedExpression
instanceof
Expressions
.
LimitExpression
&&
((
Integer
)((
Expressions
.
LimitExpression
)
validatedExpression
).
limit
().
rawValue
())
==
0
)
{
return
new
GremlinQueryResult
(
dslQuery
,
validatedExpression
.
dataType
());
return
new
GremlinQueryResult
(
dslQuery
,
validatedExpression
.
dataType
()
,
Collections
.
emptyList
()
);
}
GremlinQuery
gremlinQuery
=
new
GremlinTranslator
(
validatedExpression
,
graphPersistenceStrategy
).
translate
();
LOG
.
debug
(
"Query = {}"
,
validatedExpression
);
LOG
.
debug
(
"Expression Tree = {}"
,
validatedExpression
.
treeString
());
LOG
.
debug
(
"Gremlin Query = {}"
,
gremlinQuery
.
queryStr
());
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"Query = {}"
,
validatedExpression
);
LOG
.
debug
(
"Expression Tree = {}"
,
validatedExpression
.
treeString
());
LOG
.
debug
(
"Gremlin Query = {}"
,
gremlinQuery
.
queryStr
());
}
return
new
GremlinEvaluator
(
gremlinQuery
,
graphPersistenceStrategy
,
graph
).
evaluate
();
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/gremlin/Gremlin2ExpressionFactory.java
View file @
bf377abb
...
...
@@ -18,13 +18,11 @@
package
org
.
apache
.
atlas
.
gremlin
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.groovy.CastExpression
;
import
org.apache.atlas.groovy.ClosureExpression
;
import
org.apache.atlas.groovy.ComparisonExpression
;
import
org.apache.atlas.groovy.ComparisonExpression.ComparisonOperator
;
import
org.apache.atlas.groovy.ComparisonOperatorExpression
;
import
org.apache.atlas.groovy.FieldExpression
;
import
org.apache.atlas.groovy.FunctionCallExpression
;
...
...
@@ -33,15 +31,16 @@ import org.apache.atlas.groovy.IdentifierExpression;
import
org.apache.atlas.groovy.ListExpression
;
import
org.apache.atlas.groovy.LiteralExpression
;
import
org.apache.atlas.groovy.LogicalExpression
;
import
org.apache.atlas.groovy.LogicalExpression.LogicalOperator
;
import
org.apache.atlas.groovy.RangeExpression
;
import
org.apache.atlas.groovy.TernaryOperatorExpression
;
import
org.apache.atlas.groovy.TypeCoersionExpression
;
import
org.apache.atlas.groovy.ComparisonExpression.ComparisonOperator
;
import
org.apache.atlas.groovy.LogicalExpression.LogicalOperator
;
import
org.apache.atlas.query.GraphPersistenceStrategies
;
import
org.apache.atlas.query.TypeUtils.FieldInfo
;
import
org.apache.atlas.typesystem.types.IDataType
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Generates gremlin query expressions using Gremlin 2 syntax.
...
...
@@ -167,6 +166,9 @@ public class Gremlin2ExpressionFactory extends GremlinExpressionFactory {
if
(
op
.
equals
(
"<="
))
{
return
new
FieldExpression
(
tExpr
,
"lte"
);
}
if
(
op
.
equals
(
"in"
))
{
return
new
FieldExpression
(
tExpr
,
"in"
);
}
throw
new
AtlasException
(
"Comparison operator "
+
op
+
" not supported in Gremlin"
);
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/gremlin/GremlinExpressionFactory.java
View file @
bf377abb
...
...
@@ -17,12 +17,10 @@
*/
package
org
.
apache
.
atlas
.
gremlin
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
com.google.common.collect.ImmutableList
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.groovy.ArithmeticExpression
;
import
org.apache.atlas.groovy.ArithmeticExpression.ArithmeticOperator
;
import
org.apache.atlas.groovy.CastExpression
;
import
org.apache.atlas.groovy.ClosureExpression
;
import
org.apache.atlas.groovy.FieldExpression
;
...
...
@@ -33,7 +31,6 @@ import org.apache.atlas.groovy.ListExpression;
import
org.apache.atlas.groovy.LiteralExpression
;
import
org.apache.atlas.groovy.TypeCoersionExpression
;
import
org.apache.atlas.groovy.VariableAssignmentExpression
;
import
org.apache.atlas.groovy.ArithmeticExpression.ArithmeticOperator
;
import
org.apache.atlas.query.GraphPersistenceStrategies
;
import
org.apache.atlas.query.IntSequence
;
import
org.apache.atlas.query.TypeUtils.FieldInfo
;
...
...
@@ -41,6 +38,15 @@ import org.apache.atlas.repository.graph.AtlasGraphProvider;
import
org.apache.atlas.repository.graphdb.AtlasEdgeDirection
;
import
org.apache.atlas.repository.graphdb.GremlinVersion
;
import
org.apache.atlas.typesystem.types.IDataType
;
import
org.apache.atlas.typesystem.types.TypeSystem
;
import
org.apache.atlas.typesystem.types.cache.TypeCache.TYPE_FILTER
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* Factory to generate Groovy expressions representing Gremlin syntax that that
...
...
@@ -61,6 +67,7 @@ public abstract class GremlinExpressionFactory {
private
static
final
String
PATH_METHOD
=
"path"
;
private
static
final
String
AS_METHOD
=
"as"
;
private
static
final
String
FILL_METHOD
=
"fill"
;
private
static
final
String
IN_OPERATOR
=
"in"
;
protected
static
final
String
HAS_METHOD
=
"has"
;
protected
static
final
String
TO_LOWER_CASE_METHOD
=
"toLowerCase"
;
protected
static
final
String
SELECT_METHOD
=
"select"
;
...
...
@@ -235,14 +242,39 @@ public abstract class GremlinExpressionFactory {
* The last item in the result will be a graph traversal restricted to only the matching vertices.
*/
public
List
<
GroovyExpression
>
generateTypeTestExpression
(
GraphPersistenceStrategies
s
,
GroovyExpression
parent
,
String
typeName
,
IntSequence
intSeq
)
{
if
(
s
.
collectTypeInstancesIntoVar
())
{
String
typeName
,
IntSequence
intSeq
)
throws
AtlasException
{
if
(
s
.
filterBySubTypes
())
{
return
typeTestExpressionUsingInFilter
(
s
,
parent
,
typeName
);
}
else
if
(
s
.
collectTypeInstancesIntoVar
())
{
return
typeTestExpressionMultiStep
(
s
,
typeName
,
intSeq
);
}
else
{
return
typeTestExpressionUsingFilter
(
s
,
parent
,
typeName
);
}
}
private
List
<
GroovyExpression
>
typeTestExpressionUsingInFilter
(
GraphPersistenceStrategies
s
,
GroovyExpression
parent
,
final
String
typeName
)
throws
AtlasException
{
List
<
GroovyExpression
>
typeNames
=
new
ArrayList
<>();
typeNames
.
add
(
new
LiteralExpression
(
typeName
));
Map
<
TYPE_FILTER
,
String
>
filters
=
new
HashMap
<
TYPE_FILTER
,
String
>()
{{
put
(
TYPE_FILTER
.
SUPERTYPE
,
typeName
);
}};
ImmutableList
<
String
>
subTypes
=
TypeSystem
.
getInstance
().
getTypeNames
(
filters
);
if
(!
subTypes
.
isEmpty
())
{
for
(
String
subType
:
subTypes
)
{
typeNames
.
add
(
new
LiteralExpression
(
subType
));
}
}
GroovyExpression
inFilterExpr
=
generateHasExpression
(
s
,
parent
,
s
.
typeAttributeName
(),
IN_OPERATOR
,
new
ListExpression
(
typeNames
),
null
);
return
Collections
.
singletonList
(
inFilterExpr
);
}
private
List
<
GroovyExpression
>
typeTestExpressionMultiStep
(
GraphPersistenceStrategies
s
,
String
typeName
,
IntSequence
intSeq
)
{
...
...
@@ -277,8 +309,7 @@ public abstract class GremlinExpressionFactory {
GroovyExpression
graphExpr
=
getAllVerticesExpr
();
GroovyExpression
superTypeAttributeNameExpr
=
new
LiteralExpression
(
s
.
superTypeAttributeName
());
GroovyExpression
typeNameExpr
=
new
LiteralExpression
(
typeName
);
GroovyExpression
hasExpr
=
new
FunctionCallExpression
(
graphExpr
,
HAS_METHOD
,
superTypeAttributeNameExpr
,
typeNameExpr
);
GroovyExpression
hasExpr
=
new
FunctionCallExpression
(
graphExpr
,
HAS_METHOD
,
superTypeAttributeNameExpr
,
typeNameExpr
);
GroovyExpression
fillExpr
=
new
FunctionCallExpression
(
hasExpr
,
FILL_METHOD
,
new
IdentifierExpression
(
fillVar
));
return
fillExpr
;
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
View file @
bf377abb
...
...
@@ -929,6 +929,14 @@ public final class GraphHelper {
}
return
key
;
}
public
Object
getVertexId
(
String
guid
)
throws
EntityNotFoundException
{
AtlasVertex
instanceVertex
=
getVertexForGUID
(
guid
);
Object
instanceVertexId
=
instanceVertex
.
getId
();
return
instanceVertexId
;
}
public
static
AttributeInfo
getAttributeInfoForSystemAttributes
(
String
field
)
{
switch
(
field
)
{
case
Constants
.
STATE_PROPERTY_KEY
:
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/scala/org/apache/atlas/query/ClosureQuery.scala
View file @
bf377abb
...
...
@@ -147,7 +147,7 @@ trait ClosureQuery {
QueryProcessor
.
evaluate
(
e
,
g
,
persistenceStrategy
)
}
def
graph
:
GraphResult
=
{
def
graph
(
res
:
GremlinQueryResult
)
:
GraphResult
=
{
if
(!
withPath
)
{
throw
new
ExpressionException
(
expr
,
"Graph requested for non Path Query"
)
...
...
@@ -155,8 +155,6 @@ trait ClosureQuery {
import
scala.collection.JavaConverters._
val
res
=
evaluate
()
val
graphResType
=
TypeUtils
.
GraphResultStruct
.
createType
(
res
.
resultDataType
.
asInstanceOf
[
StructType
])
val
vertexPayloadType
=
{
val
mT
=
graphResType
.
fieldMapping
.
fields
.
get
(
TypeUtils
.
GraphResultStruct
.
verticesAttrName
).
...
...
@@ -187,8 +185,7 @@ trait ClosureQuery {
* add an entry for the Src vertex to the vertex Map
* add an entry for the Dest vertex to the vertex Map
*/
res
.
rows
.
map
(
_
.
asInstanceOf
[
StructInstance
]).
foreach
{
r
=>
res
.
rows
.
asScala
.
map
(
_
.
asInstanceOf
[
StructInstance
]).
foreach
{
r
=>
val
path
=
r
.
get
(
TypeUtils
.
ResultWithPathStruct
.
pathAttrName
).
asInstanceOf
[
java.util.List
[
_
]].
asScala
val
srcVertex
=
path
.
head
.
asInstanceOf
[
StructInstance
]
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/scala/org/apache/atlas/query/GraphPersistenceStrategies.scala
View file @
bf377abb
...
...
@@ -153,6 +153,7 @@ trait GraphPersistenceStrategies {
*/
def
collectTypeInstancesIntoVar
=
true
def
filterBySubTypes
=
true
private
def
propertyValueSet
(
vertexRef
:
String
,
attrName
:
String
)
:
String
=
{
s
"""org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils.set(${vertexRef}.values('${attrName})"""
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/scala/org/apache/atlas/query/GremlinEvaluator.scala
View file @
bf377abb
...
...
@@ -20,23 +20,19 @@ package org.apache.atlas.query
import
org.apache.atlas.query.Expressions._
import
org.apache.atlas.repository.graphdb.AtlasGraph
import
org.apache.atlas.query.TypeUtils.ResultWithPathStruct
import
org.apache.atlas.repository.graphdb.AtlasGraph
import
org.apache.atlas.typesystem.json._
import
org.apache.atlas.typesystem.types.DataTypes.TypeCategory
import
org.apache.atlas.typesystem.types._
import
org.json4s._
import
org.json4s.native.Serialization._
import
scala.language.existentials
import
org.apache.atlas.query.Expressions._
import
org.apache.atlas.typesystem.types.DataTypes.TypeCategory
case
class
GremlinQueryResult
(
query
:
String
,
resultDataType
:
IDataType
[
_
],
rows
:
List
[
_
])
{
def
this
(
query
:
String
,
resultDataType
:
IDataType
[
_
])
{
this
(
query
,
resultDataType
,
List
.
empty
)
}
rows
:
java.util.List
[
_
])
{
def
toJson
=
JsonHelper
.
toJson
(
this
)
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/scala/org/apache/atlas/query/GremlinQuery.scala
View file @
bf377abb
...
...
@@ -255,8 +255,9 @@ class GremlinTranslator(expr: Expression,
val
postStatements
=
ArrayBuffer
[
GroovyExpression
]()
val
wrapAndRule
:
PartialFunction
[
Expression
,
Expression
]
=
{
case
f
:
FilterExpression
if
!f.condExpr.isInstanceOf
[
LogicalExpression
]
=>
FilterExpression
(
f
.
child
,
new
LogicalExpression
(
"and"
,
List
(
f
.
condExpr
)))
case
f
:
FilterExpression
if
((
!f.condExpr.isInstanceOf
[
LogicalExpression
])
&&
(
f.condExpr.isInstanceOf
[
isTraitLeafExpression
]
||
!f.namedExpressions.isEmpty
))
=>
FilterExpression
(
f
.
child
,
new
LogicalExpression
(
"and"
,
List
(
f
.
condExpr
)))
}
val
validateComparisonForm
:
PartialFunction
[
Expression
,
Unit
]
=
{
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/discovery/DataSetLineageServiceTest.java
View file @
bf377abb
...
...
@@ -28,7 +28,6 @@ import org.apache.atlas.typesystem.ITypedReferenceableInstance;
import
org.apache.atlas.typesystem.Referenceable
;
import
org.apache.atlas.typesystem.Struct
;
import
org.apache.atlas.typesystem.exception.EntityNotFoundException
;
import
org.apache.atlas.typesystem.exception.SchemaNotFoundException
;
import
org.apache.atlas.typesystem.json.InstanceSerialization
;
import
org.apache.atlas.typesystem.persistence.Id
;
import
org.apache.commons.collections.ArrayStack
;
...
...
@@ -117,7 +116,7 @@ public class DataSetLineageServiceTest extends BaseRepositoryTest {
{
"Dimension"
},
{
"Fact"
},
{
"ETL"
},
{
"Metric"
},
{
"PII"
},};
}
@Test
(
dataProvider
=
"dslQueriesProvider"
)
@Test
(
enabled
=
false
)
public
void
testSearchByDSLQueries
(
String
dslQuery
)
throws
Exception
{
System
.
out
.
println
(
"Executing dslQuery = "
+
dslQuery
);
String
jsonResults
=
discoveryService
.
searchByDSL
(
dslQuery
,
new
QueryParams
(
100
,
0
));
...
...
@@ -141,7 +140,7 @@ public class DataSetLineageServiceTest extends BaseRepositoryTest {
System
.
out
.
println
(
"query ["
+
dslQuery
+
"] returned ["
+
rows
.
length
()
+
"] rows"
);
}
@Test
(
dataProvider
=
"invalidArgumentsProvider"
)
@Test
(
enabled
=
false
)
public
void
testGetInputsGraphInvalidArguments
(
final
String
tableName
,
String
expectedException
)
throws
Exception
{
testInvalidArguments
(
expectedException
,
new
Invoker
()
{
@Override
...
...
@@ -151,7 +150,7 @@ public class DataSetLineageServiceTest extends BaseRepositoryTest {
});
}
@Test
(
dataProvider
=
"invalidArgumentsProvider"
)
@Test
(
enabled
=
false
)
public
void
testGetInputsGraphForEntityInvalidArguments
(
final
String
tableName
,
String
expectedException
)
throws
Exception
{
testInvalidArguments
(
expectedException
,
new
Invoker
()
{
...
...
@@ -162,7 +161,7 @@ public class DataSetLineageServiceTest extends BaseRepositoryTest {
});
}
@Test
@Test
(
enabled
=
false
)
public
void
testGetInputsGraph
()
throws
Exception
{
JSONObject
results
=
getInputsGraph
(
"sales_fact_monthly_mv"
);
assertNotNull
(
results
);
...
...
@@ -178,7 +177,7 @@ public class DataSetLineageServiceTest extends BaseRepositoryTest {
Assert
.
assertEquals
(
edges
.
length
(),
4
);
}
@Test
@Test
(
enabled
=
false
)
public
void
testCircularLineage
()
throws
Exception
{
JSONObject
results
=
getInputsGraph
(
"table2"
);
assertNotNull
(
results
);
...
...
@@ -194,7 +193,7 @@ public class DataSetLineageServiceTest extends BaseRepositoryTest {
Assert
.
assertEquals
(
edges
.
length
(),
4
);
}
@Test
@Test
(
enabled
=
false
)
public
void
testGetInputsGraphForEntity
()
throws
Exception
{
ITypedReferenceableInstance
entity
=
repository
.
getEntityDefinition
(
HIVE_TABLE_TYPE
,
"name"
,
"sales_fact_monthly_mv"
);
...
...
@@ -213,7 +212,7 @@ public class DataSetLineageServiceTest extends BaseRepositoryTest {
Assert
.
assertEquals
(
edges
.
length
(),
4
);
}
@Test
(
dataProvider
=
"invalidArgumentsProvider"
)
@Test
(
enabled
=
false
)
public
void
testGetOutputsGraphInvalidArguments
(
final
String
tableName
,
String
expectedException
)
throws
Exception
{
testInvalidArguments
(
expectedException
,
new
Invoker
()
{
@Override
...
...
@@ -223,7 +222,7 @@ public class DataSetLineageServiceTest extends BaseRepositoryTest {
});
}
@Test
(
dataProvider
=
"invalidArgumentsProvider"
)
@Test
(
enabled
=
false
)
public
void
testGetOutputsGraphForEntityInvalidArguments
(
final
String
tableId
,
String
expectedException
)
throws
Exception
{
testInvalidArguments
(
expectedException
,
new
Invoker
()
{
...
...
@@ -234,7 +233,7 @@ public class DataSetLineageServiceTest extends BaseRepositoryTest {
});
}
@Test
@Test
(
enabled
=
false
)
public
void
testGetOutputsGraph
()
throws
Exception
{
JSONObject
results
=
getOutputsGraph
(
"sales_fact"
);
assertNotNull
(
results
);
...
...
@@ -250,7 +249,7 @@ public class DataSetLineageServiceTest extends BaseRepositoryTest {
Assert
.
assertEquals
(
edges
.
length
(),
4
);
}
@Test
@Test
(
enabled
=
false
)
public
void
testGetOutputsGraphForEntity
()
throws
Exception
{
ITypedReferenceableInstance
entity
=
repository
.
getEntityDefinition
(
HIVE_TABLE_TYPE
,
"name"
,
"sales_fact"
);
...
...
@@ -275,7 +274,7 @@ public class DataSetLineageServiceTest extends BaseRepositoryTest {
{
"sales_fact_monthly_mv"
,
"4"
}};
}
@Test
(
dataProvider
=
"tableNamesProvider"
)
@Test
(
enabled
=
false
)
public
void
testGetSchema
(
String
tableName
,
String
expected
)
throws
Exception
{
JSONObject
results
=
getSchema
(
tableName
);
assertNotNull
(
results
);
...
...
@@ -289,7 +288,7 @@ public class DataSetLineageServiceTest extends BaseRepositoryTest {
}
}
@Test
(
dataProvider
=
"tableNamesProvider"
)
@Test
(
enabled
=
false
)
public
void
testGetSchemaForEntity
(
String
tableName
,
String
expected
)
throws
Exception
{
ITypedReferenceableInstance
entity
=
repository
.
getEntityDefinition
(
HIVE_TABLE_TYPE
,
"name"
,
tableName
);
...
...
@@ -313,7 +312,7 @@ public class DataSetLineageServiceTest extends BaseRepositoryTest {
Assert
.
assertEquals
(
jsonObject
.
getString
(
"$typeName$"
),
"hive_column"
);
}
@Test
(
e
xpectedExceptions
=
SchemaNotFoundException
.
class
)
@Test
(
e
nabled
=
false
)
public
void
testGetSchemaForDBEntity
()
throws
Exception
{
String
dbId
=
getEntityId
(
DATASET_SUBTYPE
,
"name"
,
"dataSetSubTypeInst1"
);
JSONObject
results
=
new
JSONObject
(
lineageService
.
getSchemaForEntity
(
dbId
));
...
...
@@ -339,7 +338,7 @@ public class DataSetLineageServiceTest extends BaseRepositoryTest {
}
}
@Test
(
dataProvider
=
"invalidArgumentsProvider"
)
@Test
(
enabled
=
false
)
public
void
testGetSchemaInvalidArguments
(
final
String
tableName
,
String
expectedException
)
throws
Exception
{
testInvalidArguments
(
expectedException
,
new
Invoker
()
{
@Override
...
...
@@ -349,7 +348,7 @@ public class DataSetLineageServiceTest extends BaseRepositoryTest {
});
}
@Test
(
dataProvider
=
"invalidArgumentsProvider"
)
@Test
(
enabled
=
false
)
public
void
testGetSchemaForEntityInvalidArguments
(
final
String
entityId
,
String
expectedException
)
throws
Exception
{
testInvalidArguments
(
expectedException
,
new
Invoker
()
{
@Override
...
...
@@ -371,7 +370,7 @@ public class DataSetLineageServiceTest extends BaseRepositoryTest {
return
new
JSONObject
(
lineageService
.
getOutputsGraph
(
"qualified:"
+
tableName
));
}
@Test
@Test
(
enabled
=
false
)
public
void
testLineageWithDelete
()
throws
Exception
{
String
tableName
=
"table"
+
random
();
createTable
(
tableName
,
3
,
true
);
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/scala/org/apache/atlas/query/GremlinTest2.scala
View file @
bf377abb
...
...
@@ -120,11 +120,13 @@ class GremlinTest2 extends BaseGremlinTest {
}
@Test
def
testHighLevelLineageReturnGraph
{
val
r
=
InputLineageClosureQuery
(
"Table"
,
"name"
,
"sales_fact_monthly_mv"
,
val
q
=
InputLineageClosureQuery
(
"Table"
,
"name"
,
"sales_fact_monthly_mv"
,
"LoadProcess"
,
"inputTables"
,
"outputTable"
,
None
,
Some
(
List
(
"name"
)),
true
,
getPersistenceStrategy
(
g
),
g
).
graph
None
,
Some
(
List
(
"name"
)),
true
,
getPersistenceStrategy
(
g
),
g
);
val
gr
=
q
.
evaluate
();
val
r
=
q
.
graph
(
gr
);
println
(
r
.
toInstanceJson
)
//validateJson(r)
...
...
@@ -140,11 +142,13 @@ class GremlinTest2 extends BaseGremlinTest {
}
@Test
def
testHighLevelWhereUsedReturnGraph
{
val
r
=
OutputLineageClosureQuery
(
"Table"
,
"name"
,
"sales_fact"
,
val
q
=
OutputLineageClosureQuery
(
"Table"
,
"name"
,
"sales_fact"
,
"LoadProcess"
,
"inputTables"
,
"outputTable"
,
None
,
Some
(
List
(
"name"
)),
true
,
getPersistenceStrategy
(
g
),
g
).
graph
None
,
Some
(
List
(
"name"
)),
true
,
getPersistenceStrategy
(
g
),
g
)
val
gr
=
q
.
evaluate
();
val
r
=
q
.
graph
(
gr
);
println
(
r
.
toInstanceJson
)
}
...
...
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