void DirectDecoder::next()

in velox/dwio/dwrf/common/DirectDecoder.cpp [42:93]


void DirectDecoder<isSigned>::next(
    int64_t* const data,
    const uint64_t numValues,
    const uint64_t* nulls) {
  uint64_t position = 0;
  // skipNulls()
  if (nulls) {
    // Skip over null values.
    while (position < numValues && bits::isBitNull(nulls, position)) {
      ++position;
    }
  }

  // this is gross and very not DRY, but helps avoid branching
  if (position < numValues) {
    if (nulls) {
      if (!IntDecoder<isSigned>::useVInts) {
        for (uint64_t i = position; i < numValues; ++i) {
          if (!bits::isBitNull(nulls, i)) {
            data[i] = IntDecoder<isSigned>::readLongLE();
          }
        }
      } else if constexpr (isSigned) {
        for (uint64_t i = position; i < numValues; ++i) {
          if (!bits::isBitNull(nulls, i)) {
            data[i] = IntDecoder<isSigned>::readVsLong();
          }
        }
      } else {
        for (uint64_t i = position; i < numValues; ++i) {
          if (!bits::isBitNull(nulls, i)) {
            data[i] = static_cast<int64_t>(IntDecoder<isSigned>::readVuLong());
          }
        }
      }
    } else {
      if (!IntDecoder<isSigned>::useVInts) {
        for (uint64_t i = position; i < numValues; ++i) {
          data[i] = IntDecoder<isSigned>::readLongLE();
        }
      } else if constexpr (isSigned) {
        for (uint64_t i = position; i < numValues; ++i) {
          data[i] = IntDecoder<isSigned>::readVsLong();
        }
      } else {
        for (uint64_t i = position; i < numValues; ++i) {
          data[i] = static_cast<int64_t>(IntDecoder<isSigned>::readVuLong());
        }
      }
    }
  }
}