Esempio n. 1
0
  public MongoReader(
      String dbHost,
      String dbPort,
      String dbName,
      String dbUser,
      String dbPasswd,
      String colName,
      MongoSplit split,
      String[] readColumns) {
    this.table = new MongoTable(dbHost, dbPort, dbName, dbUser, dbPasswd, colName);
    this.split = split;
    this.readColumns = readColumns;

    this.cursor = table.findAll(readColumns).batchSize(BATCH_SIZE).skip((int) split.getStart());
    if (!split.isLastSplit()) this.cursor.limit((int) split.getLength()); // if it's the last
    // split,it will read
    // all records since
    // $start

  }
Esempio n. 2
0
 @Override
 public float getProgress() throws IOException {
   return split.getLength() > 0 ? pos / (float) split.getLength() : 1.0f;
 }