コード例 #1
0
  @Override
  public List<ByteString> getNextRows(int fetchRowNum) throws IOException {
    List<ByteString> rows = new ArrayList<ByteString>();
    int startRow = currentRow;
    int endRow = startRow + fetchRowNum;

    if (physicalExec == null) {
      return rows;
    }

    while (currentRow < endRow) {
      Tuple currentTuple = physicalExec.next();

      if (currentTuple == null) {
        physicalExec.close();
        physicalExec = null;
        break;
      }

      currentRow++;
      rows.add(ByteString.copyFrom(encoder.toBytes(currentTuple)));

      if (currentRow >= maxRow) {
        physicalExec.close();
        physicalExec = null;
        break;
      }
    }

    return rows;
  }
コード例 #2
0
 @Override
 public void close() throws Exception {
   tableDesc = null;
   outSchema = null;
   encoder = null;
   if (physicalExec != null) {
     try {
       physicalExec.close();
     } catch (Exception ignored) {
     }
   }
   physicalExec = null;
   currentRow = -1;
 }