Search in sources :

Example 6 with ReaderContext

use of com.linkedin.pinot.core.io.reader.ReaderContext in project pinot by linkedin.

the class UnSortedSingleValueSet method getLongValues.

/**
   * Reads int values for the given docIds and returns in the passed in double[].
   * Compatible data types ('int' and 'long') can be read in as long.
   *
   * @param inDocIds DocIds for which to get the values
   * @param inStartPos start index in the inDocIds array
   * @param inDocIdsSize size of docIds to read
   * @param outValues Array where output is written
   * @param outStartPos start index into output array
   */
@Override
public void getLongValues(int[] inDocIds, int inStartPos, int inDocIdsSize, long[] outValues, int outStartPos) {
    int inEndPos = inStartPos + inDocIdsSize;
    ReaderContext context = sVReader.createContext();
    switch(columnMetadata.getDataType()) {
        case INT:
            for (int i = inStartPos; i < inEndPos; i++) {
                outValues[outStartPos++] = sVReader.getInt(inDocIds[i], context);
            }
            break;
        case LONG:
            for (int i = inStartPos; i < inEndPos; i++) {
                outValues[outStartPos++] = sVReader.getLong(inDocIds[i], context);
            }
            break;
        default:
            throw new UnsupportedOperationException("Cannot fetch long values for column: " + columnMetadata.getColumnName());
    }
}
Also used : ReaderContext(com.linkedin.pinot.core.io.reader.ReaderContext)

Aggregations

ReaderContext (com.linkedin.pinot.core.io.reader.ReaderContext)6 SingleColumnMultiValueReader (com.linkedin.pinot.core.io.reader.SingleColumnMultiValueReader)1 SingleColumnMultiValueWriter (com.linkedin.pinot.core.io.writer.SingleColumnMultiValueWriter)1 PinotDataBuffer (com.linkedin.pinot.core.segment.memory.PinotDataBuffer)1 File (java.io.File)1 RandomAccessFile (java.io.RandomAccessFile)1 Random (java.util.Random)1