/** * Current position * * @return The position */ public int position() { return rowBlock.getMemory().writerPosition(); }
@Override public void close() throws IOException{ if (partitionMemoryMap.size() > 0) { for (RowBlock rowBlock : partitionMemoryMap.values()) { rowBlock.release(); } partitionMemoryMap.clear(); } progress = 1.0f; super.close(); } }
public boolean next(RowBlock rowblock) throws IOException { long reamin = reader == null ? 0 : reader.remainForRead(); boolean ret = rowblock.copyFromChannel(channel); reader = rowblock.getReader(); filePosition += rowblock.getMemory().writerPosition() - reamin; return ret; }
OffHeapRowBlockWriter(RowBlock rowBlock) { super(rowBlock.getDataTypes()); this.rowBlock = rowBlock; if (!rowBlock.getMemory().hasAddress()) { throw new TajoInternalError(rowBlock.getMemory().getClass().getSimpleName() + " does not support to direct memory access"); } }
@Override public void seek(long offset) throws IOException { channel.seek(offset); filePosition = channel.position(); tupleBuffer.clear(); fetchNeeded = true; }
@Override public TajoDataTypes.DataType[] dataTypes() { return rowBlock.getDataTypes(); }
OffHeapRowBlockWriter(RowBlock rowBlock) { super(rowBlock.getDataTypes()); this.rowBlock = rowBlock; if (!rowBlock.getMemory().hasAddress()) { throw new TajoInternalError(rowBlock.getMemory().getClass().getSimpleName() + " does not support to direct memory access"); } }
@Override public void seek(long offset) throws IOException { channel.seek(offset); filePosition = channel.position(); tupleBuffer.clear(); fetchNeeded = true; }
@Override public DataType[] dataTypes() { return rowBlock.getDataTypes(); }
public CompactRowBlockWriter(RowBlock rowBlock) { this.dataTypes = rowBlock.getDataTypes(); this.rowBlock = rowBlock; // compute the number of bytes, representing the null flags nullFlags = new BitArray(dataTypes.length); headerSize = RECORD_FIELD_SIZE + SizeOf.SIZE_OF_SHORT + nullFlags.bytesLength(); if (!rowBlock.getMemory().hasAddress()) { throw new TajoInternalError(rowBlock.getMemory().getClass().getSimpleName() + " does not support to direct memory access"); } }
public boolean next(RowBlock rowblock) throws IOException { long reamin = reader == null ? 0 : reader.remainForRead(); boolean ret = rowblock.copyFromChannel(channel); reader = rowblock.getReader(); filePosition += rowblock.getMemory().writerPosition() - reamin; return ret; }
@Override public boolean addTuple(Tuple tuple) { try { if (tuple instanceof UnSafeTuple) { UnSafeTuple unSafeTuple = TUtil.checkTypeAndGet(tuple, UnSafeTuple.class); addTuple(unSafeTuple); rowBlock.setRows(rowBlock.rows() + 1); } else { OffHeapRowBlockUtils.convert(tuple, this); } } catch (ValueOutOfRangeException e) { return false; } return true; } }
@Override public void close() throws IOException{ if (partitionMemoryMap.size() > 0) { for (RowBlock rowBlock : partitionMemoryMap.values()) { rowBlock.release(); } partitionMemoryMap.clear(); } progress = 1.0f; super.close(); } }
@Override public void init() throws IOException { initChannel(); if (tupleBuffer == null) { tupleBuffer = new MemoryRowBlock(SchemaUtil.toDataTypes(schema), conf.getInt(READ_BUFFER_SIZE, DEFAULT_BUFFER_SIZE)); } else { tupleBuffer.clear(); } fetchNeeded = true; eos = false; super.init(); }
@Override public DataType[] dataTypes() { return rowBlock.getDataTypes(); }
public CompactRowBlockWriter(RowBlock rowBlock) { this.dataTypes = rowBlock.getDataTypes(); this.rowBlock = rowBlock; // compute the number of bytes, representing the null flags nullFlags = new BitArray(dataTypes.length); headerSize = RECORD_FIELD_SIZE + SizeOf.SIZE_OF_SHORT + nullFlags.bytesLength(); if (!rowBlock.getMemory().hasAddress()) { throw new TajoInternalError(rowBlock.getMemory().getClass().getSimpleName() + " does not support to direct memory access"); } }