use of org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream in project asterixdb by apache.
the class RecordIdReader method set.
public void set(FrameTupleAccessor accessor, RecordDescriptor inRecDesc) {
this.tupleAccessor = accessor;
this.fieldSlotsLength = accessor.getFieldSlotsLength();
this.inRecDesc = inRecDesc;
this.bbis = new ByteBufferInputStream();
this.dis = new DataInputStream(bbis);
}
use of org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream in project asterixdb by apache.
the class FrameDebugUtils method prettyPrint.
/**
* Debugging method
* They are safe as they don't print records. Printing records
* using IserializerDeserializer can print incorrect results or throw exceptions.
* A better way yet would be to use record pointable.
* @param fta
* @param recordDescriptor
* @param prefix
* @param recordFields
* @throws IOException
*/
public void prettyPrint(IFrameTupleAccessor fta, RecordDescriptor recordDescriptor, String prefix, int[] recordFields) throws IOException {
try (ByteBufferInputStream bbis = new ByteBufferInputStream();
DataInputStream dis = new DataInputStream(bbis)) {
int tc = fta.getTupleCount();
StringBuilder sb = new StringBuilder();
sb.append(prefix).append("TC: " + tc).append("\n");
for (int i = 0; i < tc; ++i) {
prettyPrint(fta, recordDescriptor, i, bbis, dis, sb, recordFields);
}
System.err.println(sb.toString());
}
}
use of org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream in project asterixdb by apache.
the class FrameTupleAppenderAccessor method prettyPrint.
public void prettyPrint() {
ByteBufferInputStream bbis = new ByteBufferInputStream();
DataInputStream dis = new DataInputStream(bbis);
int tc = getTupleCount();
System.err.println("TC: " + tc);
for (int i = 0; i < tc; ++i) {
prettyPrint(i, bbis, dis);
}
}
use of org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream in project asterixdb by apache.
the class FrameTupleAppenderAccessor method prettyPrint.
public void prettyPrint(int tid) {
ByteBufferInputStream bbis = new ByteBufferInputStream();
DataInputStream dis = new DataInputStream(bbis);
prettyPrint(tid, bbis, dis);
}
use of org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream in project asterixdb by apache.
the class AbstractIntegrationTest method readResults.
protected List<String> readResults(JobSpecification spec, JobId jobId, ResultSetId resultSetId) throws Exception {
int nReaders = 1;
IFrameTupleAccessor frameTupleAccessor = new ResultFrameTupleAccessor();
IHyracksDataset hyracksDataset = new HyracksDataset(hcc, spec.getFrameSize(), nReaders);
IHyracksDatasetReader reader = hyracksDataset.createReader(jobId, resultSetId);
List<String> resultRecords = new ArrayList<>();
ByteBufferInputStream bbis = new ByteBufferInputStream();
FrameManager resultDisplayFrameMgr = new FrameManager(spec.getFrameSize());
VSizeFrame frame = new VSizeFrame(resultDisplayFrameMgr);
int readSize = reader.read(frame);
while (readSize > 0) {
try {
frameTupleAccessor.reset(frame.getBuffer());
for (int tIndex = 0; tIndex < frameTupleAccessor.getTupleCount(); tIndex++) {
int start = frameTupleAccessor.getTupleStartOffset(tIndex);
int length = frameTupleAccessor.getTupleEndOffset(tIndex) - start;
bbis.setByteBuffer(frame.getBuffer(), start);
byte[] recordBytes = new byte[length];
bbis.read(recordBytes, 0, length);
resultRecords.add(new String(recordBytes, 0, length));
}
} finally {
bbis.close();
}
readSize = reader.read(frame);
}
return resultRecords;
}
Aggregations