Skip to content

Commit

Permalink
Support for removing Universal Set
Browse files Browse the repository at this point in the history
  • Loading branch information
mineralntl committed Oct 23, 2024
1 parent 60cf2ef commit c063ec2
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 133 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<relativePath>../../../microservices/microservice-parent/pom.xml</relativePath>
</parent>
<artifactId>metadata-utils</artifactId>
<version>4.0.7-SNAPSHOT</version>
<version>4.0.7-TESTING-1814</version>
<url>https://code.nsa.gov/datawave-metadata-utils</url>
<licenses>
<license>
Expand Down
40 changes: 14 additions & 26 deletions src/main/java/datawave/query/util/AllFieldMetadataHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -754,15 +754,7 @@ public Set<String> getTermFrequencyFields(Set<String> ingestTypeFilter) throws T

Multimap<String,String> termFrequencyFields = loadTermFrequencyFields();

Set<String> fields = new HashSet<>();
if (ingestTypeFilter == null || ingestTypeFilter.isEmpty()) {
fields.addAll(termFrequencyFields.values());
} else {
for (String datatype : ingestTypeFilter) {
fields.addAll(termFrequencyFields.get(datatype));
}
}
return Collections.unmodifiableSet(fields);
return getFields(termFrequencyFields, ingestTypeFilter);
}

/**
Expand All @@ -778,15 +770,7 @@ public Set<String> getExpansionFields(Set<String> ingestTypeFilter) throws Table

Multimap<String,String> expansionFields = loadExpansionFields();

Set<String> fields = new HashSet<>();
if (ingestTypeFilter == null || ingestTypeFilter.isEmpty()) {
fields.addAll(expansionFields.values());
} else {
for (String datatype : ingestTypeFilter) {
fields.addAll(expansionFields.get(datatype));
}
}
return Collections.unmodifiableSet(fields);
return getFields(expansionFields, ingestTypeFilter);
}

/**
Expand All @@ -802,15 +786,19 @@ public Set<String> getContentFields(Set<String> ingestTypeFilter) throws TableNo

Multimap<String,String> contentFields = loadContentFields();

Set<String> fields = new HashSet<>();
if (ingestTypeFilter == null || ingestTypeFilter.isEmpty()) {
fields.addAll(contentFields.values());
} else {
return getFields(contentFields, ingestTypeFilter);
}

private Set<String> getFields(Multimap<String,String> fields, Set<String> ingestTypeFilter) {
Set<String> returnedFields = new HashSet<>();
if (ingestTypeFilter == null) {
returnedFields.addAll(fields.values());
} else if (!ingestTypeFilter.isEmpty()) {
for (String datatype : ingestTypeFilter) {
fields.addAll(contentFields.get(datatype));
}
returnedFields.addAll(fields.get(datatype));
} // non-null but empty typeFilters allow nothing
}
return Collections.unmodifiableSet(fields);
return Collections.unmodifiableSet(returnedFields);
}

/**
Expand Down Expand Up @@ -1291,7 +1279,7 @@ private Map<String,Map<String,FieldIndexHole>> getFieldIndexHoles(Text targetCol
throws TableNotFoundException, IOException {
// create local copies to avoid side effects
fields = new HashSet<>(fields);
datatypes = new HashSet<>(datatypes);
datatypes = datatypes == null ? null : new HashSet<>(datatypes);

// Handle null fields if given.
if (fields == null) {
Expand Down
Loading

0 comments on commit c063ec2

Please sign in to comment.