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

Method DecodeIndicesSpaced

cpp/src/parquet/decoder.cc:931–960  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

929 void InsertDictionary(::arrow::ArrayBuilder* builder) override;
930
931 int DecodeIndicesSpaced(int num_values, int null_count, const uint8_t* valid_bits,
932 int64_t valid_bits_offset,
933 ::arrow::ArrayBuilder* builder) override {
934 if (num_values > 0) {
935 // TODO(wesm): Refactor to batch reads for improved memory use. It is not
936 // trivial because the null_count is relative to the entire bitmap
937 PARQUET_THROW_NOT_OK(indices_scratch_space_->TypedResize<int32_t>(
938 num_values, /*shrink_to_fit=*/false));
939 }
940
941 auto indices_buffer = indices_scratch_space_->mutable_data_as<int32_t>();
942
943 if (num_values != idx_decoder_.GetBatchSpaced(num_values, null_count, valid_bits,
944 valid_bits_offset, indices_buffer)) {
945 ParquetException::EofException();
946 }
947
948 // XXX(wesm): Cannot append "valid bits" directly to the builder
949 std::vector<uint8_t> valid_bytes(num_values, 0);
950 size_t i = 0;
951 VisitNullBitmapInline(
952 valid_bits, valid_bits_offset, num_values, null_count,
953 [&]() { valid_bytes[i++] = 1; }, [&]() { ++i; });
954
955 auto binary_builder = checked_cast<::arrow::BinaryDictionary32Builder*>(builder);
956 PARQUET_THROW_NOT_OK(
957 binary_builder->AppendIndices(indices_buffer, num_values, valid_bytes.data()));
958 this->num_values_ -= num_values - null_count;
959 return num_values - null_count;
960 }
961
962 int DecodeIndices(int num_values, ::arrow::ArrayBuilder* builder) override {
963 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