Class FixedByteSingleValueMultiColReader

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class FixedByteSingleValueMultiColReader
    extends Object
    implements Closeable
    Generic utility class to read data from file. The data file consists of rows and columns. The number of columns are fixed. Each column can have either single value or multiple values. There are two basic types of methods to read the data
    1. <TYPE> getType(int row, int col) this is used for single value column
    2. int getTYPEArray(int row, int col, TYPE[] array). The caller has to create and initialize the array. The implementation will fill up the array. The caller is responsible to ensure that the array is big enough to fit all the values. The return value tells the number of values.
    • Constructor Detail

      • FixedByteSingleValueMultiColReader

        public FixedByteSingleValueMultiColReader​(PinotDataBuffer dataBuffer,
                                                  int numRows,
                                                  int[] columnSizes)
    • Method Detail

      • getChar

        public char getChar​(int row,
                            int col)
        Parameters:
        row -
        col -
        Returns:
      • getShort

        public short getShort​(int row,
                              int col)
        Parameters:
        row -
        col -
        Returns:
      • getInt

        public int getInt​(int row,
                          int col)
        Parameters:
        row -
        col -
        Returns:
      • getLong

        public long getLong​(int row,
                            int col)
        Parameters:
        row -
        col -
        Returns:
      • getFloat

        public float getFloat​(int row,
                              int col)
        Parameters:
        row -
        col -
        Returns:
      • getDouble

        public double getDouble​(int row,
                                int col)
        Reads the double at row,col
        Parameters:
        row -
        col -
        Returns:
      • getString

        public String getString​(int row,
                                int col)
        Returns the string value, NOTE: It expects all String values in the file to be of same length
        Parameters:
        row -
        col -
        Returns:
      • getBytes

        public byte[] getBytes​(int row,
                               int col)
        Generic method to read the raw bytes
        Parameters:
        row -
        col -
        Returns:
      • getNumberOfRows

        public int getNumberOfRows()
      • getColumnSizes

        public int[] getColumnSizes()
      • open

        public boolean open()
      • readIntValues

        public void readIntValues​(int[] rows,
                                  int col,
                                  int startPos,
                                  int limit,
                                  int[] values,
                                  int outStartPos)
      • readLongValues

        public void readLongValues​(int[] rows,
                                   int col,
                                   int startPos,
                                   int limit,
                                   long[] values,
                                   int outStartPos)
      • readFloatValues

        public void readFloatValues​(int[] rows,
                                    int col,
                                    int startPos,
                                    int limit,
                                    float[] values,
                                    int outStartPos)
      • readDoubleValues

        public void readDoubleValues​(int[] rows,
                                     int col,
                                     int startPos,
                                     int limit,
                                     double[] values,
                                     int outStartPos)
      • readStringValues

        public void readStringValues​(int[] rows,
                                     int col,
                                     int startPos,
                                     int limit,
                                     String[] values,
                                     int outStartPos)