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