Github user smarthi commented on a diff in the pull request:
https://github.com/apache/incubator-pirk/pull/74#discussion_r75535198
--- Diff:
src/main/java/org/apache/pirk/responder/wideskies/common/ComputeEncryptedRow.java
---
@@ -319,4 +314,80 @@ public static void loadCacheFromHDFS(FileSystem fs,
String hdfsFileName, Query q
return returnPairs;
}
+
+ /**
+ * Method to compute the encrypted row elements for a query from
extracted data partitions in the form of ArrayList<<BigInteger>>
+ * <p/>
+ * For each row (as indicated by key = hash(selector)), iterates over
the dataPartitions and calculates the column values.
+ * <p/>
+ * Uses a static LRU cache for the modular exponentiation
+ * <p/>
+ * Caller is responsible for keeping track of the colIndex and the the
maxHitsPerSelector values
+ * <p/>
+ * Emits {@code Tuple2<<colNum, colVal>>}
+ */
+ public static ArrayList<Tuple2<Long,BigInteger>>
computeEncRow(ArrayList<BigInteger> dataPartitions, Query query, int rowIndex,
int colIndex)
+ throws IOException
+ {
+ ArrayList<Tuple2<Long,BigInteger>> returnPairs = new
ArrayList<Tuple2<Long,BigInteger>>();
+
+ // Pull the corresponding encrypted row query
+ BigInteger rowQuery = query.getQueryElement(rowIndex);
+
+ // Initialize the column counter
+ long colCounter = colIndex;
+
+ logger.debug("dataPartitions.size() = " + dataPartitions + " rowIndex
= " + rowIndex + " colCounter = " + colCounter);
+
+ // Update the associated column values
+ for (int i = 0; i < dataPartitions.size(); ++i)
+ {
+ BigInteger part = dataPartitions.get(i);
+
+ BigInteger exp = null;
+ try
+ {
+ exp = expCache.get(new
Tuple3<BigInteger,BigInteger,BigInteger>(rowQuery, part, query.getNSquared()));
+ } catch (ExecutionException e)
+ {
+ e.printStackTrace();
+ }
+
+ logger.debug("rowIndex = " + rowIndex + " colCounter = " +
colCounter + " part = " + part.toString() + " part binary = " +
part.toString(2) + " exp = "
+ + exp + " i = " + i + " partition = " + dataPartitions.get(i) +
" = " + dataPartitions.get(i).toString(2));
+
+ returnPairs.add(new Tuple2<Long,BigInteger>(colCounter, exp));
+
+ ++colCounter;
+ }
+
+ return returnPairs;
+ }
+
+ public static ArrayList<Tuple2<Long,BigInteger>>
computeEncRow(BigInteger part, Query query, int rowIndex, int colIndex) throws
IOException
+ {
+ ArrayList<Tuple2<Long,BigInteger>> returnPairs = new
ArrayList<Tuple2<Long,BigInteger>>();
--- End diff --
Use a List on LHS and as return type of method
---
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.
---