Search in sources :

Example 11 with ByteBufferInputStream

use of org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream in project asterixdb by apache.

the class FrameDebugUtils method prettyPrint.

/**
     * Debugging method
     * @param fta
     * @param recordDescriptor
     * @param prefix
     */
public void prettyPrint(IFrameTupleAccessor fta, RecordDescriptor recordDescriptor, String prefix) {
    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);
        }
        System.err.println(sb.toString());
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : ByteBufferInputStream(org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream) IOException(java.io.IOException) DataInputStream(java.io.DataInputStream)

Example 12 with ByteBufferInputStream

use of org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream in project asterixdb by apache.

the class FrameDebugUtils method prettyPrint.

/**
     * Debugging method
     * @param tuple
     * @param fieldsIdx
     * @param descIdx
     * @throws HyracksDataException
     */
public void prettyPrint(IFrameTupleAccessor fta, RecordDescriptor recordDescriptor, ITupleReference tuple, int fieldsIdx, int descIdx) throws HyracksDataException {
    try (ByteBufferInputStream bbis = new ByteBufferInputStream();
        DataInputStream dis = new DataInputStream(bbis)) {
        StringBuilder sb = new StringBuilder();
        sb.append("[");
        sb.append("f" + fieldsIdx + ":(" + tuple.getFieldStart(fieldsIdx) + ", " + (tuple.getFieldLength(fieldsIdx) + tuple.getFieldStart(fieldsIdx)) + ") ");
        sb.append("{");
        ByteBuffer bytebuff = ByteBuffer.wrap(tuple.getFieldData(fieldsIdx));
        bbis.setByteBuffer(bytebuff, tuple.getFieldStart(fieldsIdx));
        sb.append(recordDescriptor.getFields()[descIdx].deserialize(dis));
        sb.append("}");
        sb.append("\n");
        System.err.println(sb.toString());
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : ByteBufferInputStream(org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream) IOException(java.io.IOException) DataInputStream(java.io.DataInputStream) ByteBuffer(java.nio.ByteBuffer)

Example 13 with ByteBufferInputStream

use of org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream in project asterixdb by apache.

the class FrameDebugUtils method prettyPrintTags.

/**
     * Debugging method
     * @param fta
     * @param operator
     */
public void prettyPrintTags(IFrameTupleAccessor fta, String operator) {
    try (ByteBufferInputStream bbis = new ByteBufferInputStream();
        DataInputStream dis = new DataInputStream(bbis)) {
        int tc = fta.getTupleCount();
        StringBuilder sb = new StringBuilder();
        sb.append(operator + ":");
        sb.append("TC: " + tc).append("\n");
        for (int i = 0; i < tc; ++i) {
            prettyPrintTag(fta, i, bbis, dis, sb);
        }
        System.err.println(sb.toString());
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : ByteBufferInputStream(org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream) IOException(java.io.IOException) DataInputStream(java.io.DataInputStream)

Example 14 with ByteBufferInputStream

use of org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream in project asterixdb by apache.

the class FrameDebugUtils method prettyPrint.

/**
     * Debugging method
     * @param tuple
     * @param descF
     * @throws HyracksDataException
     */
public void prettyPrint(IFrameTupleAccessor fta, RecordDescriptor recordDescriptor, ITupleReference tuple, int[] descF) throws HyracksDataException {
    try (ByteBufferInputStream bbis = new ByteBufferInputStream();
        DataInputStream dis = new DataInputStream(bbis)) {
        StringBuilder sb = new StringBuilder();
        sb.append("[");
        for (int j = 0; j < descF.length; ++j) {
            sb.append("f" + j + ":(" + tuple.getFieldStart(j) + ", " + (tuple.getFieldLength(j) + tuple.getFieldStart(j)) + ") ");
            sb.append("{");
            ByteBuffer bytebuff = ByteBuffer.wrap(tuple.getFieldData(j));
            bbis.setByteBuffer(bytebuff, tuple.getFieldStart(j));
            sb.append(recordDescriptor.getFields()[descF[j]].deserialize(dis));
            sb.append("}");
        }
        sb.append("\n");
        System.err.println(sb.toString());
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : ByteBufferInputStream(org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream) IOException(java.io.IOException) DataInputStream(java.io.DataInputStream) ByteBuffer(java.nio.ByteBuffer)

Example 15 with ByteBufferInputStream

use of org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream in project asterixdb by apache.

the class FrameDebugUtils method prettyPrint.

/**
     * Debugging method
     * @param fta
     * @param recordDescriptor
     * @param tid
     */
public void prettyPrint(IFrameTupleAccessor fta, RecordDescriptor recordDescriptor, int tid) {
    try (ByteBufferInputStream bbis = new ByteBufferInputStream();
        DataInputStream dis = new DataInputStream(bbis)) {
        StringBuilder sb = new StringBuilder();
        prettyPrint(fta, recordDescriptor, tid, bbis, dis, sb);
        System.err.println(sb.toString());
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : ByteBufferInputStream(org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream) IOException(java.io.IOException) DataInputStream(java.io.DataInputStream)

Aggregations

ByteBufferInputStream (org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream)16 DataInputStream (java.io.DataInputStream)14 IOException (java.io.IOException)7 ByteBuffer (java.nio.ByteBuffer)3 IFrameTupleAccessor (org.apache.hyracks.api.comm.IFrameTupleAccessor)3 VSizeFrame (org.apache.hyracks.api.comm.VSizeFrame)2 RecordDescriptor (org.apache.hyracks.api.dataflow.value.RecordDescriptor)2 IHyracksDataset (org.apache.hyracks.api.dataset.IHyracksDataset)2 IHyracksDatasetReader (org.apache.hyracks.api.dataset.IHyracksDatasetReader)2 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)2 HyracksDataset (org.apache.hyracks.client.dataset.HyracksDataset)2 FrameManager (org.apache.hyracks.control.nc.resources.memory.FrameManager)2 FrameTupleAccessor (org.apache.hyracks.dataflow.common.comm.io.FrameTupleAccessor)2 ResultFrameTupleAccessor (org.apache.hyracks.dataflow.common.comm.io.ResultFrameTupleAccessor)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 BufferedWriter (java.io.BufferedWriter)1 FileWriter (java.io.FileWriter)1 PrintStream (java.io.PrintStream)1 ArrayList (java.util.ArrayList)1