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

Method DecodeIndicesSpaced

cpp/src/parquet/decoder.cc:951–980  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

949 void InsertDictionary(::arrow::ArrayBuilder* builder) override;
950
951 int DecodeIndicesSpaced(int num_values, int null_count, const uint8_t* valid_bits,
952 int64_t valid_bits_offset,
953 ::arrow::ArrayBuilder* builder) override {
954 if (num_values > 0) {
955 // TODO(wesm): Refactor to batch reads for improved memory use. It is not
956 // trivial because the null_count is relative to the entire bitmap
957 PARQUET_THROW_NOT_OK(indices_scratch_space_->TypedResize<int32_t>(
958 num_values, /*shrink_to_fit=*/false));
959 }
960
961 auto indices_buffer = indices_scratch_space_->mutable_data_as<int32_t>();
962
963 if (num_values != idx_decoder_.GetBatchSpaced(num_values, null_count, valid_bits,
964 valid_bits_offset, indices_buffer)) {
965 ParquetException::EofException();
966 }
967
968 // XXX(wesm): Cannot append "valid bits" directly to the builder
969 std::vector<uint8_t> valid_bytes(num_values, 0);
970 size_t i = 0;
971 VisitNullBitmapInline(
972 valid_bits, valid_bits_offset, num_values, null_count,
973 [&]() { valid_bytes[i++] = 1; }, [&]() { ++i; });
974
975 auto binary_builder = checked_cast<::arrow::BinaryDictionary32Builder*>(builder);
976 PARQUET_THROW_NOT_OK(
977 binary_builder->AppendIndices(indices_buffer, num_values, valid_bytes.data()));
978 this->num_values_ -= num_values - null_count;
979 return num_values - null_count;
980 }
981
982 int DecodeIndices(int num_values, ::arrow::ArrayBuilder* builder) override {
983 num_values = std::min(num_values, this->num_values_);

Callers 2

ReadValuesSpacedMethod · 0.80
TEST_FFunction · 0.80

Calls 4

VisitNullBitmapInlineFunction · 0.85
GetBatchSpacedMethod · 0.80
AppendIndicesMethod · 0.45
dataMethod · 0.45

Tested by 1

TEST_FFunction · 0.64