| 1338 | } |
| 1339 | |
| 1340 | int64_t WriteBatchInternal(int64_t num_values, const int16_t* def_levels, |
| 1341 | const int16_t* rep_levels, const T* values) { |
| 1342 | // We check for DataPage limits only after we have inserted the values. If a user |
| 1343 | // writes a large number of values, the DataPage size can be much above the limit. |
| 1344 | // The purpose of this chunking is to bound this. Even if a user writes large number |
| 1345 | // of values, the chunking will ensure the AddDataPage() is called at a reasonable |
| 1346 | // pagesize limit |
| 1347 | int64_t value_offset = 0; |
| 1348 | |
| 1349 | auto WriteChunk = [&](int64_t offset, int64_t batch_size, bool check_page) { |
| 1350 | int64_t values_to_write = WriteLevels(batch_size, AddIfNotNull(def_levels, offset), |
| 1351 | AddIfNotNull(rep_levels, offset)); |
| 1352 | |
| 1353 | // PARQUET-780 |
| 1354 | if (values_to_write > 0) { |
| 1355 | DCHECK_NE(nullptr, values); |
| 1356 | } |
| 1357 | const int64_t num_nulls = batch_size - values_to_write; |
| 1358 | WriteValues(AddIfNotNull(values, value_offset), values_to_write, num_nulls); |
| 1359 | CommitWriteAndCheckPageLimit(batch_size, values_to_write, num_nulls, check_page); |
| 1360 | value_offset += values_to_write; |
| 1361 | |
| 1362 | // Dictionary size checked separately from data page size since we |
| 1363 | // circumvent this check when writing ::arrow::DictionaryArray directly |
| 1364 | CheckDictionarySizeLimit(); |
| 1365 | }; |
| 1366 | DoInBatches(def_levels, rep_levels, num_values, properties_->write_batch_size(), |
| 1367 | properties_->max_rows_per_page(), pages_change_on_record_boundaries(), |
| 1368 | WriteChunk, [this]() { return num_buffered_rows_; }); |
| 1369 | return value_offset; |
| 1370 | } |
| 1371 | |
| 1372 | void WriteBatchSpaced(int64_t num_values, const int16_t* def_levels, |
| 1373 | const int16_t* rep_levels, const uint8_t* valid_bits, |
nothing calls this directly
no test coverage detected