Ejemplo n.º 1
0
    protected void setup(Context context) throws IOException, InterruptedException {
      super.setup(context);

      Path pt = new Path("/user/yao/query/query");
      FileSystem fs = FileSystem.get(new Configuration());
      BufferedReader br = new BufferedReader(new InputStreamReader(fs.open(pt)));
      String line = br.readLine();
      String[] keywords = line.split(",");
      k0 = keywords[0];
      k1 = keywords[1];
      k2 = keywords[2];
      br.close();
    }
Ejemplo n.º 2
0
 private int getNumSecrets(Path secretsPath) throws Exception {
   FileSystem fileSystem = FileSystem.get(secretsPath.toUri(), getConf());
   FSDataInputStream inputStream = fileSystem.open(secretsPath);
   BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
   String currentLine;
   int numLines = 0;
   while ((currentLine = reader.readLine()) != null) {
     if (!currentLine.isEmpty()) {
       numLines++;
     }
   }
   reader.close();
   return numLines;
 }