-
Notifications
You must be signed in to change notification settings - Fork 271
generate edges depending on type category #2882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hlgp
wants to merge
10
commits into
integration
Choose a base branch
from
feature/edgeByCategory
base: integration
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
320f29c
generate edges depending on type category
hlgp 7d165b2
allow types to specify a sub category
hlgp 6c7b90a
Merge branch 'integration' into feature/typeCategories
hlgp 8a80aec
Merge branch 'integration' into feature/edgeByCategory
hlgp d75c72a
Merge branch 'feature/typeCategories' into feature/edgeByCategory
hlgp 9f1a92b
merge category changes
hlgp fea2e24
Merge branch 'integration' into feature/edgeByCategory
hlgp 389f2e1
Merge branch 'integration' into feature/edgeByCategory
hlgp c7d264a
Merge branch 'integration' into feature/edgeByCategory
hlgp ec24db4
fix tests
hlgp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,7 @@ | |
| import org.apache.hadoop.mapreduce.StatusReporter; | ||
| import org.apache.hadoop.mapreduce.TaskAttemptContext; | ||
| import org.apache.hadoop.mapreduce.TaskInputOutputContext; | ||
| import org.apache.hadoop.util.Lists; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
| import org.springframework.context.support.ClassPathXmlApplicationContext; | ||
|
|
@@ -156,6 +157,8 @@ public class ProtobufEdgeDataTypeHandler<KEYIN,KEYOUT,VALUEOUT> implements Exten | |
| long futureDelta, pastDelta; | ||
| long newFormatStartDate; | ||
|
|
||
| protected List<datawave.data.type.Type.Category> allowedCategories = Lists.newArrayList(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer to see a static import for Type.Category |
||
|
|
||
| SimpleGroupFieldNameParser fieldParser = new SimpleGroupFieldNameParser(); | ||
|
|
||
| public enum FailurePolicy { | ||
|
|
@@ -274,6 +277,9 @@ public void setup(Configuration conf) { | |
| if (thing.getEnrichmentTypeMappings() != null) { | ||
| edgeTypeLookup.put(entry.getKey(), thing.getEnrichmentTypeMappings()); | ||
| } | ||
| if (thing.getAllowedTypeCategories() != null) { | ||
| allowedCategories.addAll(thing.getAllowedTypeCategories()); | ||
| } | ||
| } | ||
|
|
||
| if (ctx.containsBean(entry.getKey() + EDGE_TABLE_DISALLOWLIST_VALUES)) { | ||
|
|
@@ -673,6 +679,9 @@ public long process(KEYIN key, RawRecordContainer event, Multimap<String,Normali | |
| if (ifaceSource == ifaceSink) { | ||
| continue; | ||
| } | ||
| if (!isAllowedCategory(ifaceSource, ifaceSink)) { | ||
| continue; | ||
| } | ||
| EdgeDataBundle edgeValue = createEdge(edgeDef, event, ifaceSource, sourceGroup, subGroup, ifaceSink, sinkGroup, subGroup, | ||
| edgeAttribute2, edgeAttribute3, normalizedFields, depthFirstList, loadDateStr, activityDate, validActivityDate); | ||
| if (edgeValue != null) { | ||
|
|
@@ -696,6 +705,9 @@ public long process(KEYIN key, RawRecordContainer event, Multimap<String,Normali | |
| for (NormalizedContentInterface ifaceSource : mSource.get(sourceSubGroup)) { | ||
| for (String sinkSubGroup : mSink.keySet()) { | ||
| for (NormalizedContentInterface ifaceSink : mSink.get(sinkSubGroup)) { | ||
| if (!isAllowedCategory(ifaceSource, ifaceSink)) { | ||
| continue; | ||
| } | ||
| EdgeDataBundle edgeValue = createEdge(edgeDef, event, ifaceSource, sourceGroup, sourceSubGroup, ifaceSink, sinkGroup, | ||
| sinkSubGroup, edgeAttribute2, edgeAttribute3, normalizedFields, depthFirstList, loadDateStr, activityDate, | ||
| validActivityDate); | ||
|
|
@@ -724,6 +736,9 @@ public long process(KEYIN key, RawRecordContainer event, Multimap<String,Normali | |
| if (ifaceSource == ifaceSink) { | ||
| continue; | ||
| } | ||
| if (!isAllowedCategory(ifaceSource, ifaceSink)) { | ||
| continue; | ||
| } | ||
| EdgeDataBundle edgeValue = createEdge(edgeDef, event, ifaceSource, sourceGroup, subGroup, ifaceSink, sinkGroup, subGroup, | ||
| edgeAttribute2, edgeAttribute3, normalizedFields, depthFirstList, loadDateStr, activityDate, validActivityDate); | ||
| if (edgeValue != null) { | ||
|
|
@@ -749,6 +764,9 @@ public long process(KEYIN key, RawRecordContainer event, Multimap<String,Normali | |
| for (NormalizedContentInterface ifaceSource : mSource.get(sourceSubGroup)) { | ||
| for (String sinkSubGroup : sinkSubGroups) { | ||
| for (NormalizedContentInterface ifaceSink : mSink.get(sinkSubGroup)) { | ||
| if (!isAllowedCategory(ifaceSource, ifaceSink)) { | ||
| continue; | ||
| } | ||
| EdgeDataBundle edgeValue = createEdge(edgeDef, event, ifaceSource, sourceGroup, sourceSubGroup, ifaceSink, sinkGroup, | ||
| sinkSubGroup, edgeAttribute2, edgeAttribute3, normalizedFields, depthFirstList, loadDateStr, activityDate, | ||
| validActivityDate); | ||
|
|
@@ -1442,4 +1460,10 @@ public RawRecordMetadata getMetadata() { | |
| public void setVersioningCache(EdgeKeyVersioningCache versioningCache) { | ||
| this.versioningCache = versioningCache; | ||
| } | ||
|
|
||
| public boolean isAllowedCategory(NormalizedContentInterface source, NormalizedContentInterface sink) { | ||
| // normalizers that do not specify a category do not have special subtypes, so allow null | ||
| return (allowedCategories.isEmpty() || (allowedCategories.contains(source.getTypeCategory()) && allowedCategories.contains(sink.getTypeCategory()) | ||
| || (null == source.getTypeCategory() && null == sink.getTypeCategory()))); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want separate allowed type categories for the source and the sink ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would let the bidirectional config dictate that.