Github user smarthi commented on a diff in the pull request:
https://github.com/apache/incubator-pirk/pull/74#discussion_r75537551
--- Diff: src/main/java/org/apache/pirk/query/wideskies/QueryInfo.java ---
@@ -96,6 +98,42 @@ public QueryInfo(UUID identifierInput, int
numSelectorsInput, int hashBitSizeInp
printQueryInfo();
}
+ public QueryInfo(Map queryInfoMap)
+ {
+ // Seemed that the Storm Config would serialize the map as a json and
read back in with numeric values as longs.
+ // So had to cast as a long and call .intValue. However, this didn't
work in the PirkHashScheme and had to try
+ // the normal way of doing it as well.
+ try
+ {
+ identifier = UUID.fromString((String) queryInfoMap.get("uuid"));
+ queryType = (String) queryInfoMap.get("queryType");
+ numSelectors = ((Long) queryInfoMap.get("numSelectors")).intValue();
+ hashBitSize = ((Long) queryInfoMap.get("hashBitSize")).intValue();
+ hashKey = (String) queryInfoMap.get("hashKey");
+ numBitsPerDataElement = ((Long)
queryInfoMap.get("numBitsPerDataElement")).intValue();
+ numPartitionsPerDataElement = ((Long)
queryInfoMap.get("numPartitionsPerDataElement")).intValue();
+ dataPartitionBitSize = ((Long)
queryInfoMap.get("dataPartitionsBitSize")).intValue();
+ useExpLookupTable = (boolean) queryInfoMap.get("useExpLookupTable");
+ useHDFSExpLookupTable = (boolean)
queryInfoMap.get("useHDFSExpLookupTable");
+ embedSelector = (boolean) queryInfoMap.get("embedSelector");
+ } catch (ClassCastException e)
+ {
+ identifier = UUID.fromString((String) queryInfoMap.get("uuid"));
+ queryType = (String) queryInfoMap.get("queryType");
+ numSelectors = (int) queryInfoMap.get("numSelectors");
+ hashBitSize = (int) queryInfoMap.get("hashBitSize");
+ hashKey = (String) queryInfoMap.get("hashKey");
+ numBitsPerDataElement = (int)
queryInfoMap.get("numBitsPerDataElement");
+ numPartitionsPerDataElement = (int)
queryInfoMap.get("numPartitionsPerDataElement");
+ dataPartitionBitSize = (int)
queryInfoMap.get("dataPartitionsBitSize");
+ useExpLookupTable = (boolean) queryInfoMap.get("useExpLookupTable");
+ useHDFSExpLookupTable = (boolean)
queryInfoMap.get("useHDFSExpLookupTable");
+ embedSelector = (boolean) queryInfoMap.get("embedSelector");
+
+ }
--- End diff --
?? ?Why r we doing the same thing in try and catch clauses ?
---
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.
---