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
cd96e3ad
Commit
cd96e3ad
authored
May 21, 2015
by
Shwetha GS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support for search using super types
parent
5becd8a5
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
46 additions
and
7 deletions
+46
-7
MetadataServiceClient.java
...ava/org/apache/hadoop/metadata/MetadataServiceClient.java
+1
-0
pom.xml
pom.xml
+1
-1
DefaultGraphPersistenceStrategy.java
...data/discovery/graph/DefaultGraphPersistenceStrategy.java
+5
-1
MetadataRepository.java
...apache/hadoop/metadata/repository/MetadataRepository.java
+2
-1
GraphBackedMetadataRepository.java
...adata/repository/graph/GraphBackedMetadataRepository.java
+2
-2
GremlinQuery.scala
...scala/org/apache/hadoop/metadata/query/GremlinQuery.scala
+8
-2
GraphBackedMetadataRepositoryTest.java
...a/repository/graph/GraphBackedMetadataRepositoryTest.java
+27
-0
No files found.
client/src/main/java/org/apache/hadoop/metadata/MetadataServiceClient.java
View file @
cd96e3ad
...
@@ -73,6 +73,7 @@ public class MetadataServiceClient {
...
@@ -73,6 +73,7 @@ public class MetadataServiceClient {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
LOG
.
info
(
"Error processing client configuration."
,
e
);
LOG
.
info
(
"Error processing client configuration."
,
e
);
}
}
URLConnectionClientHandler
handler
=
SecureClientUtils
.
getClientConnectionHandler
(
config
,
clientConfig
);
URLConnectionClientHandler
handler
=
SecureClientUtils
.
getClientConnectionHandler
(
config
,
clientConfig
);
Client
client
=
new
Client
(
handler
,
config
);
Client
client
=
new
Client
(
handler
,
config
);
...
...
pom.xml
View file @
cd96e3ad
...
@@ -78,7 +78,7 @@
...
@@ -78,7 +78,7 @@
<slf4j.version>
1.7.7
</slf4j.version>
<slf4j.version>
1.7.7
</slf4j.version>
<jetty.version>
6.1.26
</jetty.version>
<jetty.version>
6.1.26
</jetty.version>
<jersey.version>
1.9
</jersey.version>
<jersey.version>
1.9
</jersey.version>
<tinkerpop.version>
2.
5
.0
</tinkerpop.version>
<tinkerpop.version>
2.
6
.0
</tinkerpop.version>
<titan.version>
0.5.4
</titan.version>
<titan.version>
0.5.4
</titan.version>
<hadoop.version>
2.6.0
</hadoop.version>
<hadoop.version>
2.6.0
</hadoop.version>
...
...
repository/src/main/java/org/apache/hadoop/metadata/discovery/graph/DefaultGraphPersistenceStrategy.java
View file @
cd96e3ad
...
@@ -71,7 +71,11 @@ public class DefaultGraphPersistenceStrategy implements GraphPersistenceStrategi
...
@@ -71,7 +71,11 @@ public class DefaultGraphPersistenceStrategy implements GraphPersistenceStrategi
@Override
@Override
public
String
fieldNameInVertex
(
IDataType
<?>
dataType
,
AttributeInfo
aInfo
)
{
public
String
fieldNameInVertex
(
IDataType
<?>
dataType
,
AttributeInfo
aInfo
)
{
return
metadataRepository
.
getFieldNameInVertex
(
dataType
,
aInfo
);
try
{
return
metadataRepository
.
getFieldNameInVertex
(
dataType
,
aInfo
);
}
catch
(
MetadataException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
@Override
@Override
...
...
repository/src/main/java/org/apache/hadoop/metadata/repository/MetadataRepository.java
View file @
cd96e3ad
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
package
org
.
apache
.
hadoop
.
metadata
.
repository
;
package
org
.
apache
.
hadoop
.
metadata
.
repository
;
import
org.apache.hadoop.metadata.MetadataException
;
import
org.apache.hadoop.metadata.typesystem.IReferenceableInstance
;
import
org.apache.hadoop.metadata.typesystem.IReferenceableInstance
;
import
org.apache.hadoop.metadata.typesystem.ITypedReferenceableInstance
;
import
org.apache.hadoop.metadata.typesystem.ITypedReferenceableInstance
;
import
org.apache.hadoop.metadata.typesystem.ITypedStruct
;
import
org.apache.hadoop.metadata.typesystem.ITypedStruct
;
...
@@ -61,7 +62,7 @@ public interface MetadataRepository {
...
@@ -61,7 +62,7 @@ public interface MetadataRepository {
* @param aInfo attribute info
* @param aInfo attribute info
* @return property key used to store a given attribute
* @return property key used to store a given attribute
*/
*/
String
getFieldNameInVertex
(
IDataType
<?>
dataType
,
AttributeInfo
aInfo
);
String
getFieldNameInVertex
(
IDataType
<?>
dataType
,
AttributeInfo
aInfo
)
throws
MetadataException
;
/**
/**
* Return the edge label for a given attribute in the repository.
* Return the edge label for a given attribute in the repository.
...
...
repository/src/main/java/org/apache/hadoop/metadata/repository/graph/GraphBackedMetadataRepository.java
View file @
cd96e3ad
...
@@ -122,8 +122,8 @@ public class GraphBackedMetadataRepository implements MetadataRepository {
...
@@ -122,8 +122,8 @@ public class GraphBackedMetadataRepository implements MetadataRepository {
}
}
@Override
@Override
public
String
getFieldNameInVertex
(
IDataType
<?>
dataType
,
AttributeInfo
aInfo
)
{
public
String
getFieldNameInVertex
(
IDataType
<?>
dataType
,
AttributeInfo
aInfo
)
throws
MetadataException
{
return
dataType
.
getName
()
+
"."
+
aInfo
.
name
;
return
getQualifiedName
(
dataType
,
aInfo
.
name
)
;
}
}
@Override
@Override
...
...
repository/src/main/scala/org/apache/hadoop/metadata/query/GremlinQuery.scala
View file @
cd96e3ad
...
@@ -184,8 +184,14 @@ class GremlinTranslator(expr: Expression,
...
@@ -184,8 +184,14 @@ class GremlinTranslator(expr: Expression,
}
}
private
def
genQuery
(
expr
:
Expression
,
inSelect
:
Boolean
)
:
String
=
expr
match
{
private
def
genQuery
(
expr
:
Expression
,
inSelect
:
Boolean
)
:
String
=
expr
match
{
case
ClassExpression
(
clsName
)
=>
s
"""has("${gPersistenceBehavior.typeAttributeName}","$clsName")"""
case
ClassExpression
(
clsName
)
=>
case
TraitExpression
(
clsName
)
=>
s
"""has("${gPersistenceBehavior.typeAttributeName}","$clsName")"""
val
typeName
=
gPersistenceBehavior
.
typeAttributeName
val
superTypeName
=
gPersistenceBehavior
.
superTypeAttributeName
s
"""filter{(it.$typeName == "$clsName") | (it.$superTypeName ? it.$superTypeName.contains("$clsName") : false)}"""
.
stripMargin
case
TraitExpression
(
clsName
)
=>
val
typeName
=
gPersistenceBehavior
.
typeAttributeName
val
superTypeName
=
gPersistenceBehavior
.
superTypeAttributeName
s
"""filter{(it.$typeName == "$clsName") | (it.$superTypeName ? it.$superTypeName.contains("$clsName") : false)}"""
.
stripMargin
case
fe
@FieldExpression
(
fieldName
,
fInfo
,
child
)
if
fe
.
dataType
.
getTypeCategory
==
TypeCategory
.
PRIMITIVE
=>
{
case
fe
@FieldExpression
(
fieldName
,
fInfo
,
child
)
if
fe
.
dataType
.
getTypeCategory
==
TypeCategory
.
PRIMITIVE
=>
{
val
fN
=
"\""
+
gPersistenceBehavior
.
fieldNameInVertex
(
fInfo
.
dataType
,
fInfo
.
attrInfo
)
+
"\""
val
fN
=
"\""
+
gPersistenceBehavior
.
fieldNameInVertex
(
fInfo
.
dataType
,
fInfo
.
attrInfo
)
+
"\""
child
match
{
child
match
{
...
...
repository/src/test/java/org/apache/hadoop/metadata/repository/graph/GraphBackedMetadataRepositoryTest.java
View file @
cd96e3ad
...
@@ -349,6 +349,33 @@ public class GraphBackedMetadataRepositoryTest {
...
@@ -349,6 +349,33 @@ public class GraphBackedMetadataRepositoryTest {
}
}
}
}
@Test
(
dependsOnMethods
=
"testSubmitEntity"
)
public
void
testSearchByDSLWithInheritance
()
throws
Exception
{
String
dslQuery
=
"Person where name = 'Jane'"
;
System
.
out
.
println
(
"Executing dslQuery = "
+
dslQuery
);
String
jsonResults
=
discoveryService
.
searchByDSL
(
dslQuery
);
Assert
.
assertNotNull
(
jsonResults
);
JSONObject
results
=
new
JSONObject
(
jsonResults
);
Assert
.
assertEquals
(
results
.
length
(),
3
);
System
.
out
.
println
(
"results = "
+
results
);
Object
query
=
results
.
get
(
"query"
);
Assert
.
assertNotNull
(
query
);
JSONObject
dataType
=
results
.
getJSONObject
(
"dataType"
);
Assert
.
assertNotNull
(
dataType
);
String
typeName
=
dataType
.
getString
(
"typeName"
);
Assert
.
assertEquals
(
typeName
,
"Person"
);
JSONArray
rows
=
results
.
getJSONArray
(
"rows"
);
Assert
.
assertEquals
(
rows
.
length
(),
1
);
JSONObject
row
=
rows
.
getJSONObject
(
0
);
Assert
.
assertEquals
(
row
.
getString
(
"$typeName$"
),
"Manager"
);
Assert
.
assertEquals
(
row
.
getString
(
"name"
),
"Jane"
);
}
/**
/**
* Full text search requires GraphBackedSearchIndexer, and GraphBackedSearchIndexer can't be enabled in
* Full text search requires GraphBackedSearchIndexer, and GraphBackedSearchIndexer can't be enabled in
* GraphBackedDiscoveryServiceTest because of its test data. So, test for full text search is in
* GraphBackedDiscoveryServiceTest because of its test data. So, test for full text search is in
...
...
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