Class FixedByteSingleValueMultiColReader
- java.lang.Object
-
- org.apache.pinot.segment.local.io.reader.impl.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 Summary
Constructors Constructor Description FixedByteSingleValueMultiColReader(PinotDataBuffer dataBuffer, int numRows, int[] columnSizes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()byte[]getBytes(int row, int col)Generic method to read the raw byteschargetChar(int row, int col)int[]getColumnSizes()doublegetDouble(int row, int col)Reads the double at row,colfloatgetFloat(int row, int col)intgetInt(int row, int col)longgetLong(int row, int col)intgetNumberOfRows()shortgetShort(int row, int col)StringgetString(int row, int col)Returns the string value, NOTE: It expects all String values in the file to be of same lengthbooleanopen()voidreadDoubleValues(int[] rows, int col, int startPos, int limit, double[] values, int outStartPos)voidreadFloatValues(int[] rows, int col, int startPos, int limit, float[] values, int outStartPos)voidreadIntValues(int[] rows, int col, int startPos, int limit, int[] values, int outStartPos)voidreadLongValues(int[] rows, int col, int startPos, int limit, long[] values, int outStartPos)voidreadStringValues(int[] rows, int col, int startPos, int limit, String[] values, int outStartPos)
-
-
-
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)
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-