Skip to content
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

Support for removing Universal Set #44

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading