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
24830e6b
Commit
24830e6b
authored
Aug 15, 2018
by
Chengbing Liu
Committed by
apoorvnaik
Aug 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2816: Allow ignoring relationship in
EntityGraphRetriever for FullTextMapperV2 Signed-off-by:
apoorvnaik
<
apoorvnaik@apache.org
>
parent
52ef9e7f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
9 deletions
+20
-9
FullTextMapperV2.java
...a/org/apache/atlas/repository/graph/FullTextMapperV2.java
+11
-9
EntityGraphRetriever.java
...atlas/repository/store/graph/v2/EntityGraphRetriever.java
+9
-0
No files found.
repository/src/main/java/org/apache/atlas/repository/graph/FullTextMapperV2.java
View file @
24830e6b
...
@@ -6,9 +6,9 @@
...
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* with the License. You may obtain a copy of the License at
*
*
<p>
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*
<p>
* Unless required by applicable law or agreed to in writing, software
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
@@ -53,16 +53,17 @@ public class FullTextMapperV2 {
...
@@ -53,16 +53,17 @@ public class FullTextMapperV2 {
private
static
final
String
FULL_TEXT_EXCLUDE_ATTRIBUTE_PROPERTY
=
"atlas.search.fulltext.type"
;
private
static
final
String
FULL_TEXT_EXCLUDE_ATTRIBUTE_PROPERTY
=
"atlas.search.fulltext.type"
;
private
final
EntityGraphRetriever
entityGraphRetriever
;
private
final
EntityGraphRetriever
entityGraphRetriever
;
private
final
Configuration
configuration
;
private
final
boolean
followReferences
;
private
final
boolean
followReferences
;
private
final
Map
<
String
,
Set
<
String
>>
excludeAttributesCache
=
new
HashMap
<>();
private
final
Map
<
String
,
Set
<
String
>>
excludeAttributesCache
=
new
HashMap
<>();
private
Configuration
APPLICATION_PROPERTIES
=
null
;
@Inject
@Inject
public
FullTextMapperV2
(
AtlasTypeRegistry
typeRegistry
,
Configuration
configuration
)
{
public
FullTextMapperV2
(
AtlasTypeRegistry
typeRegistry
,
Configuration
configuration
)
{
entityGraphRetriever
=
new
EntityGraphRetriever
(
typeRegistry
);
this
.
configuration
=
configuration
;
APPLICATION_PROPERTIES
=
configuration
;
followReferences
=
this
.
configuration
!=
null
&&
this
.
configuration
.
getBoolean
(
FULL_TEXT_FOLLOW_REFERENCES
,
false
);
followReferences
=
APPLICATION_PROPERTIES
!=
null
&&
APPLICATION_PROPERTIES
.
getBoolean
(
FULL_TEXT_FOLLOW_REFERENCES
,
false
);
// If followReferences = false then ignore relationship attr loading
entityGraphRetriever
=
new
EntityGraphRetriever
(
typeRegistry
,
!
followReferences
);
}
}
/**
/**
...
@@ -207,7 +208,8 @@ public class FullTextMapperV2 {
...
@@ -207,7 +208,8 @@ public class FullTextMapperV2 {
AtlasEntityWithExtInfo
entityWithExtInfo
=
context
.
getInstanceV2
(
guid
);
AtlasEntityWithExtInfo
entityWithExtInfo
=
context
.
getInstanceV2
(
guid
);
if
(
entityWithExtInfo
==
null
)
{
if
(
entityWithExtInfo
==
null
)
{
entityWithExtInfo
=
entityGraphRetriever
.
toAtlasEntityWithExtInfo
(
guid
);
// Only map ownedRef and relationship attr when follow references is set to true
entityWithExtInfo
=
entityGraphRetriever
.
toAtlasEntityWithExtInfo
(
guid
,
!
followReferences
);
if
(
entityWithExtInfo
!=
null
)
{
if
(
entityWithExtInfo
!=
null
)
{
context
.
cache
(
entityWithExtInfo
);
context
.
cache
(
entityWithExtInfo
);
...
@@ -230,8 +232,8 @@ public class FullTextMapperV2 {
...
@@ -230,8 +232,8 @@ public class FullTextMapperV2 {
if
(
excludeAttributesCache
.
containsKey
(
typeName
))
{
if
(
excludeAttributesCache
.
containsKey
(
typeName
))
{
ret
=
excludeAttributesCache
.
get
(
typeName
);
ret
=
excludeAttributesCache
.
get
(
typeName
);
}
else
if
(
APPLICATION_PROPERTIES
!=
null
)
{
}
else
if
(
configuration
!=
null
)
{
String
[]
excludeAttributes
=
APPLICATION_PROPERTIES
.
getStringArray
(
FULL_TEXT_EXCLUDE_ATTRIBUTE_PROPERTY
+
"."
+
String
[]
excludeAttributes
=
configuration
.
getStringArray
(
FULL_TEXT_EXCLUDE_ATTRIBUTE_PROPERTY
+
"."
+
typeName
+
"."
+
"attributes.exclude"
);
typeName
+
"."
+
"attributes.exclude"
);
if
(
ArrayUtils
.
isNotEmpty
(
excludeAttributes
))
{
if
(
ArrayUtils
.
isNotEmpty
(
excludeAttributes
))
{
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
View file @
24830e6b
...
@@ -138,8 +138,15 @@ public final class EntityGraphRetriever {
...
@@ -138,8 +138,15 @@ public final class EntityGraphRetriever {
private
final
AtlasTypeRegistry
typeRegistry
;
private
final
AtlasTypeRegistry
typeRegistry
;
private
final
boolean
ignoreRelationshipAttr
;
public
EntityGraphRetriever
(
AtlasTypeRegistry
typeRegistry
)
{
public
EntityGraphRetriever
(
AtlasTypeRegistry
typeRegistry
)
{
this
(
typeRegistry
,
false
);
}
public
EntityGraphRetriever
(
AtlasTypeRegistry
typeRegistry
,
boolean
ignoreRelationshipAttr
)
{
this
.
typeRegistry
=
typeRegistry
;
this
.
typeRegistry
=
typeRegistry
;
this
.
ignoreRelationshipAttr
=
ignoreRelationshipAttr
;
}
}
public
AtlasEntity
toAtlasEntity
(
String
guid
)
throws
AtlasBaseException
{
public
AtlasEntity
toAtlasEntity
(
String
guid
)
throws
AtlasBaseException
{
...
@@ -385,7 +392,9 @@ public final class EntityGraphRetriever {
...
@@ -385,7 +392,9 @@ public final class EntityGraphRetriever {
mapAttributes
(
entityVertex
,
entity
,
entityExtInfo
,
isMinExtInfo
);
mapAttributes
(
entityVertex
,
entity
,
entityExtInfo
,
isMinExtInfo
);
if
(!
ignoreRelationshipAttr
)
{
// only map when really needed
mapRelationshipAttributes
(
entityVertex
,
entity
);
mapRelationshipAttributes
(
entityVertex
,
entity
);
}
mapClassifications
(
entityVertex
,
entity
);
mapClassifications
(
entityVertex
,
entity
);
}
}
...
...
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