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

Method DecodeIndicesSpaced

cpp/src/parquet/decoder.cc:932–961  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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