@Override public void run() { try { rowBlock.clear(); int endRow = currentNumRows + fetchRowNum; while (currentNumRows < endRow) { Tuple tuple = scanExec.next(); if (tuple == null) { eof = true; break; } else { rowBlock.getWriter().addTuple(tuple); currentNumRows++; if (currentNumRows >= maxRow) { eof = true; break; } } } if (rowBlock.rows() > 0) { totalRows += rowBlock.rows(); } future.set(rowBlock); } catch (Throwable t) { future.setException(t); } } });
@Override public void convert(Tuple tuple, RowWriter writer) { if (analyzeField) { if (tuple instanceof UnSafeTuple) { for (int i = 0; i < writer.dataTypes().length; i++) { // it is to calculate min/max values, and it is only used for the intermediate file. stats.analyzeField(i, tuple); } // write direct to memory writer.addTuple(tuple); } else { writer.startRow(); for (int i = 0; i < writer.dataTypes().length; i++) { // it is to calculate min/max values, and it is only used for the intermediate file. stats.analyzeField(i, tuple); writeField(i, tuple, writer); } writer.endRow(); } } else { // write direct to memory writer.addTuple(tuple); } } };
@Override public void convert(Tuple tuple, RowWriter writer) { if (analyzeField) { if (tuple instanceof UnSafeTuple) { for (int i = 0; i < writer.dataTypes().length; i++) { // it is to calculate min/max values, and it is only used for the intermediate file. stats.analyzeField(i, tuple); } // write direct to memory writer.addTuple(tuple); } else { writer.startRow(); for (int i = 0; i < writer.dataTypes().length; i++) { // it is to calculate min/max values, and it is only used for the intermediate file. stats.analyzeField(i, tuple); writeField(i, tuple, writer); } writer.endRow(); } } else { // write direct to memory writer.addTuple(tuple); } } };
public boolean addTuple(Tuple tuple) { int prevPos = currentRowBlock.getMemory().writerPosition(); if (currentRowBlock.getWriter().addTuple(tuple)) { UnSafeTuple unSafeTuple = new UnSafeTuple(); unSafeTuple.set(currentRowBlock.getMemory(), prevPos, dataTypes); return super.add(unSafeTuple); } else { this.totalUsedMem += currentRowBlock.usedMem(); this.currentRowBlock = new MemoryRowBlock(dataTypes, new FixedSizeLimitSpec(pageSize), true); this.rowBlocks.add(currentRowBlock); return this.addTuple(tuple); } }
public boolean addTuple(Tuple tuple) { int prevPos = currentRowBlock.getMemory().writerPosition(); if (currentRowBlock.getWriter().addTuple(tuple)) { UnSafeTuple unSafeTuple = new UnSafeTuple(); unSafeTuple.set(currentRowBlock.getMemory(), prevPos, dataTypes); return super.add(unSafeTuple); } else { this.totalUsedMem += currentRowBlock.usedMem(); this.currentRowBlock = new MemoryRowBlock(dataTypes, new FixedSizeLimitSpec(pageSize), true); this.rowBlocks.add(currentRowBlock); return this.addTuple(tuple); } }
totalBufferCapacity -= rowBlock.capacity(); writer.addTuple(tuple); numRows++;
totalBufferCapacity -= rowBlock.capacity(); writer.addTuple(tuple); numRows++;
break; } else { rowBlock.getWriter().addTuple(tuple); currentNumRows++; if (currentNumRows >= maxRow) {
rowBlock.getWriter().addTuple(currentTuple); currentRow++; rowCount++;
rowBlock.getWriter().addTuple(currentTuple); currentRow++; rowCount++;
rowBlock.getWriter().addTuple(outTuple);
rowBlock.getWriter().addTuple(outTuple);