| 295 | |
| 296 | template <bool has_repeated_parent> |
| 297 | int64_t DefLevelsBatchToBitmap(const int16_t* def_levels, const int64_t batch_size, |
| 298 | int64_t upper_bound_remaining, LevelInfo level_info, |
| 299 | ::arrow::internal::FirstTimeBitmapWriter* writer) { |
| 300 | ARROW_DCHECK_LE(batch_size, kExtractBitsSize); |
| 301 | |
| 302 | // Greater than level_info.def_level - 1 implies >= the def_level |
| 303 | auto defined_bitmap = static_cast<extract_bitmap_t>(::arrow::bit_util::FromLittleEndian( |
| 304 | internal::GreaterThanBitmap(def_levels, batch_size, level_info.def_level - 1))); |
| 305 | |
| 306 | if (has_repeated_parent) { |
| 307 | // Greater than level_info.repeated_ancestor_def_level - 1 implies >= the |
| 308 | // repeated_ancestor_def_level |
| 309 | auto present_bitmap = static_cast<extract_bitmap_t>( |
| 310 | ::arrow::bit_util::FromLittleEndian(internal::GreaterThanBitmap( |
| 311 | def_levels, batch_size, level_info.repeated_ancestor_def_level - 1))); |
| 312 | auto selected_bits = ExtractBits(defined_bitmap, present_bitmap); |
| 313 | int64_t selected_count = std::popcount(present_bitmap); |
| 314 | if (ARROW_PREDICT_FALSE(selected_count > upper_bound_remaining)) { |
| 315 | throw ParquetException("Values read exceeded upper bound"); |
| 316 | } |
| 317 | writer->AppendWord(selected_bits, selected_count); |
| 318 | return std::popcount(selected_bits); |
| 319 | } else { |
| 320 | if (ARROW_PREDICT_FALSE(batch_size > upper_bound_remaining)) { |
| 321 | std::stringstream ss; |
| 322 | ss << "Values read exceeded upper bound"; |
| 323 | throw ParquetException(ss.str()); |
| 324 | } |
| 325 | |
| 326 | writer->AppendWord(defined_bitmap, batch_size); |
| 327 | return std::popcount(defined_bitmap); |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | template <bool has_repeated_parent> |
| 332 | void DefLevelsToBitmapSimd(const int16_t* def_levels, int64_t num_def_levels, |
nothing calls this directly
no test coverage detected