Github user tellison commented on a diff in the pull request:
https://github.com/apache/incubator-pirk/pull/112#discussion_r84772832
--- Diff: src/main/java/org/apache/pirk/schema/query/QuerySchemaLoader.java
---
@@ -226,50 +215,28 @@ public QuerySchema loadSchema(InputStream stream)
throws IOException, PIRExcepti
Element elements = (Element) elementsList.item(0);
LinkedHashSet<String> elementNames = new LinkedHashSet<>();
- int dataElementSize = 0;
NodeList nList = elements.getElementsByTagName("name");
for (int i = 0; i < nList.getLength(); i++)
{
Node nNode = nList.item(i);
if (nNode.getNodeType() == Node.ELEMENT_NODE)
{
- // Pull the name
- String queryElementName =
nNode.getFirstChild().getNodeValue().trim();
- if (!dataSchema.containsElement(queryElementName))
- {
- throw new PIRException("dataSchema = " + dataSchemaName + " does
not contain requested element name = " + queryElementName);
- }
- elementNames.add(queryElementName);
- logger.info("name = " + queryElementName + " partitionerName = " +
dataSchema.getPartitionerTypeName(queryElementName));
-
- // Compute the number of bits for this element.
- DataPartitioner partitioner =
dataSchema.getPartitionerForElement(queryElementName);
- int bits =
partitioner.getBits(dataSchema.getElementType(queryElementName));
-
- // Multiply by the number of array elements allowed, if applicable.
- if (dataSchema.isArrayElement(queryElementName))
- {
- bits *=
Integer.parseInt(SystemConfiguration.getProperty("pir.numReturnArrayElements"));
- }
- dataElementSize += bits;
-
- logger.info("name = " + queryElementName + " bits = " + bits + "
dataElementSize = " + dataElementSize);
+ elementNames.add(nNode.getFirstChild().getNodeValue().trim());
}
}
+ schemaBuilder.setQueryElementNames(elementNames);
// Extract the filter, if it exists
- String filterTypeName = NO_FILTER;
if (doc.getElementsByTagName("filter").item(0) != null)
{
- filterTypeName =
doc.getElementsByTagName("filter").item(0).getTextContent().trim();
+
schemaBuilder.setFilterTypeName(doc.getElementsByTagName("filter").item(0).getTextContent().trim());
}
// Create a filter over the query elements.
- Set<String> filteredNamesSet = extractFilteredElementNames(doc);
- DataFilter filter = instantiateFilter(filterTypeName,
filteredNamesSet);
+
schemaBuilder.setFilteredElementNames(extractFilteredElementNames(doc));
// Extract the additional fields, if they exists
- HashMap<String,String> additionalFields = new HashMap<String,String>();
+ Map<String,String> additionalFields = new HashMap<String,String>();
--- End diff --
Yep, I didn't spot that one - fixed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---