MCPcopy Create free account
hub / github.com/apache/arrow / Skip

Method Skip

cpp/src/parquet/column_reader.cc:1135–1162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1133
1134template <typename DType>
1135int64_t TypedColumnReaderImpl<DType>::Skip(int64_t num_values_to_skip) {
1136 int64_t values_to_skip = num_values_to_skip;
1137 // Optimization: Do not call HasNext() when values_to_skip == 0.
1138 while (values_to_skip > 0 && HasNext()) {
1139 // If the number of values to skip is more than the number of undecoded values, skip
1140 // the Page.
1141 const int64_t available_values = this->available_values_current_page();
1142 if (values_to_skip >= available_values) {
1143 values_to_skip -= available_values;
1144 this->ConsumeBufferedValues(available_values);
1145 } else {
1146 // We need to read this Page
1147 // Jump to the right offset in the Page
1148 int64_t values_read = 0;
1149 InitScratchForSkip();
1150 ARROW_DCHECK_NE(this->scratch_for_skip_, nullptr);
1151 do {
1152 int64_t batch_size = std::min(kSkipScratchBatchSize, values_to_skip);
1153 values_read = ReadBatch(static_cast<int>(batch_size),
1154 scratch_for_skip_->mutable_data_as<int16_t>(),
1155 scratch_for_skip_->mutable_data_as<int16_t>(),
1156 scratch_for_skip_->mutable_data_as<T>(), &values_read);
1157 values_to_skip -= values_read;
1158 } while (values_read > 0 && values_to_skip > 0);
1159 }
1160 }
1161 return num_values_to_skip - values_to_skip;
1162}
1163
1164} // namespace
1165

Callers 5

ReadBytesZeroCopyFunction · 0.80
ColumnReaderSkipInt32Function · 0.80
SkipRecordsMethod · 0.80
TEST_FFunction · 0.80
SkipRowsInColumnMethod · 0.80

Calls 3

HasNextFunction · 0.85
ConsumeBufferedValuesMethod · 0.80

Tested by 1

TEST_FFunction · 0.64