Github user smarthi commented on a diff in the pull request:

    https://github.com/apache/incubator-pirk/pull/119#discussion_r91297469
  
    --- Diff: pirk-core/src/main/java/org/apache/pirk/test/utils/BaseTests.java 
---
    @@ -195,14 +209,130 @@ public static void 
checkDNSHostnameQueryResults(List<QueryResponseJSON> results,
         }
       }
     
    +  private static ArrayList<String> constructBasicArgs()
    +  {
    +    ArrayList<String> args = new ArrayList<>();
    +    String inputFormat = 
SystemConfiguration.getProperty("pir.dataInputFormat");
    +    args.add("-" + ResponderProps.DATAINPUTFORMAT + "=" + inputFormat);
    +    args.add("-" + ResponderProps.QUERYINPUT + "=" + 
SystemConfiguration.getProperty("pir.queryInput"));
    +    args.add("-" + ResponderProps.OUTPUTFILE + "=" + 
SystemConfiguration.getProperty(DistributedTestDriver.OUTPUT_DIRECTORY_PROPERTY));
    +    args.add("-" + ResponderProps.STOPLISTFILE + "=" + 
SystemConfiguration.getProperty("pir.stopListFile"));
    +    args.add("-" + ResponderProps.USELOCALCACHE + "=" + 
SystemConfiguration.getProperty("pir.useLocalCache", "true"));
    +    args.add("-" + ResponderProps.LIMITHITSPERSELECTOR + "=" + 
SystemConfiguration.getProperty("pir.limitHitsPerSelector", "false"));
    +    args.add("-" + ResponderProps.MAXHITSPERSELECTOR + "=" + 
SystemConfiguration.getProperty("pir.maxHitsPerSelector", "1000"));
    +    args.add("-" + ResponderProps.QUERYSCHEMAS + "=" + 
Inputs.HDFS_QUERY_FILES);
    +    args.add("-" + ResponderProps.DATASCHEMAS + "=" + 
Inputs.DATA_SCHEMA_FILE_HDFS);
    +    args.add("-" + ResponderProps.NUMEXPLOOKUPPARTS + "=" + 
SystemConfiguration.getProperty("pir.numExpLookupPartitions", "100"));
    +    args.add("-" + ResponderProps.USEMODEXPJOIN + "=" + 
SystemConfiguration.getProperty("pir.useModExpJoin", "false"));
    +    args.add("-" + ResponderProps.NUMCOLMULTPARTITIONS + "=" + 
SystemConfiguration.getProperty("pir.numColMultPartitions", "20"));
    +    args.add("-" + ResponderProps.COLMULTREDUCEBYKEY + "=" + 
SystemConfiguration.getProperty("pir.colMultReduceByKey", "false"));
    +
    +    if (inputFormat.equals(InputFormatConst.BASE_FORMAT))
    +    {
    +      args.add("-" + ResponderProps.INPUTDATA + "=" + 
SystemConfiguration.getProperty("pir.inputData"));
    +      args.add("-" + ResponderProps.BASEQUERY + "=" + 
SystemConfiguration.getProperty("pir.baseQuery"));
    +      args.add("-" + ResponderProps.BASEINPUTFORMAT + "=" + 
SystemConfiguration.getProperty("pir.baseInputFormat"));
    +    }
    +    else if (inputFormat.equals(InputFormatConst.ES))
    +    {
    +      args.add("-" + ResponderProps.ESQUERY + "=" + 
SystemConfiguration.getProperty("pir.esQuery"));
    +      args.add("-" + ResponderProps.ESRESOURCE + "=" + 
SystemConfiguration.getProperty("pir.esResource"));
    +      args.add("-" + ResponderProps.ESNODES + "=" + 
SystemConfiguration.getProperty(DistributedTestDriver.ES_INPUT_NODES_PROPERTY));
    +      args.add("-" + ResponderProps.ESPORT + "=" + 
SystemConfiguration.getProperty(DistributedTestDriver.ES_INPUT_PORT_PROPERTY));
    +    }
    +    if (logger.isInfoEnabled())
    +    {
    +      for (String arg : args)
    +      {
    +        logger.info("arg = " + arg);
    +      }
    +    }
    +    return args;
    +  }
    +
    +  // Base method to perform query
    +  // TODO: This could be changed to pass in the platform instead of 
isSpark and isStreaming...
    +  @SuppressWarnings("unused")
    +  public static List<QueryResponseJSON> performQuery(String queryType, 
List<String> selectors, FileSystem fs, String platformName, int numThreads)
    +      throws Exception
    +  {
    +    logger.info("performQuery: ");
    +    ResponderPlugin responder = 
ResponderService.getInstance().getResponder(platformName);
    +    if (responder == null)
    +    {
    +      throw new PIRException("No such platform plugin found: " + 
platformName);
    +    }
    +    else if (!responder.hasDistributedTest())
    +    {
    +      throw new PIRException("No such distributed test for platform: " + 
platformName);
    +    }
    +
    +
    +    // Grab the original data and query schema properties to reset upon 
completion
    +    String dataSchemaProp = 
SystemConfiguration.getProperty("data.schemas");
    +    String querySchemaProp = 
SystemConfiguration.getProperty("query.schemas");
    +
    +    String queryInputDir = 
SystemConfiguration.getProperty(DistributedTestDriver.PIR_QUERY_INPUT_DIR);
    +    String outputFile = 
SystemConfiguration.getProperty(DistributedTestDriver.OUTPUT_DIRECTORY_PROPERTY);
    +    fs.delete(new Path(outputFile), true); // Ensure old output does not 
exist.
    +
    +    SystemConfiguration.setProperty("pir.queryInput", queryInputDir);
    +    SystemConfiguration.setProperty("pir.numReduceTasks", "1");
    +    SystemConfiguration.setProperty("pir.stopListFile", 
SystemConfiguration.getProperty(DistributedTestDriver.PIR_STOPLIST_FILE));
    +
    +    boolean embedSelector = 
SystemConfiguration.getBooleanProperty("pirTest.embedSelector", false);
    +    boolean useExpLookupTable = 
SystemConfiguration.getBooleanProperty("pirTest.useExpLookupTable", false);
    +    boolean useHDFSExpLookupTable = 
SystemConfiguration.getBooleanProperty("pirTest.useHDFSExpLookupTable", false);
    +
    +
    +    // Set the necessary objects
    +    QueryInfo queryInfo = new QueryInfo(BaseTests.queryIdentifier, 
selectors.size(), BaseTests.hashBitSize, BaseTests.dataPartitionBitSize,
    +        queryType, useExpLookupTable, embedSelector, 
useHDFSExpLookupTable);
    +
    +    Paillier paillier = new Paillier(BaseTests.paillierBitSize, 
BaseTests.certainty);
    +
    +    // Perform the encryption
    +    logger.info("Performing encryption of the selectors - forming 
encrypted query vectors:");
    +    EncryptQuery encryptQuery = new EncryptQuery(queryInfo, selectors, 
paillier);
    +    Querier querier = encryptQuery.encrypt(numThreads);
    +    logger.info("Completed encryption of the selectors - completed 
formation of the encrypted query vectors:");
    +
    +    // Write the Query object to a file
    +    Path queryInputDirPath = new Path(queryInputDir);
    +    new HadoopFileSystemStore(fs).store(queryInputDirPath, 
querier.getQuery());
    +    fs.deleteOnExit(queryInputDirPath);
    +
    +    // Get the correct input format class name
    +    JSONInputFormatBase jFormat = new JSONInputFormatBase();
    +    String jsonBaseInputFormatString = jFormat.getClass().getName();
    +    SystemConfiguration.setProperty("pir.baseInputFormat", 
jsonBaseInputFormatString);
    +
    +    ArrayList<String> args = constructBasicArgs();
    --- End diff --
    
    use List<String> on LHS


---
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.
---

Reply via email to