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

Method DecodeArrowDense

cpp/src/parquet/decoder.cc:2121–2157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2119 }
2120
2121 Status DecodeArrowDense(int num_values, int null_count, const uint8_t* valid_bits,
2122 int64_t valid_bits_offset,
2123 typename EncodingTraits<DType>::Accumulator* out,
2124 int* out_num_values) {
2125 std::vector<ByteArray> values(num_values - null_count);
2126 const int num_valid_values = GetInternal(values.data(), num_values - null_count);
2127 if (ARROW_PREDICT_FALSE(num_values - null_count != num_valid_values)) {
2128 throw ParquetException("Expected to decode ", num_values - null_count,
2129 " values, but decoded ", num_valid_values, " values.");
2130 }
2131
2132 auto visit_binary_helper = [&](auto* helper) {
2133 auto values_ptr = reinterpret_cast<const ByteArray*>(values.data());
2134 int value_idx = 0;
2135
2136 PARQUET_THROW_NOT_OK(
2137 VisitBitRuns(valid_bits, valid_bits_offset, num_values,
2138 [&](int64_t position, int64_t run_length, bool is_valid) {
2139 if (is_valid) {
2140 for (int64_t i = 0; i < run_length; ++i) {
2141 const auto& val = values_ptr[value_idx];
2142 RETURN_NOT_OK(helper->AppendValue(
2143 val.ptr, static_cast<int32_t>(val.len)));
2144 ++value_idx;
2145 }
2146 return Status::OK();
2147 } else {
2148 return helper->AppendNulls(run_length);
2149 }
2150 }));
2151
2152 *out_num_values = num_valid_values;
2153 return Status::OK();
2154 };
2155 return DispatchArrowBinaryHelper<DType>(out, num_values, /*estimated_data_length=*/{},
2156 visit_binary_helper);
2157 }
2158
2159 MemoryPool* pool_;
2160

Callers

nothing calls this directly

Calls 6

ParquetExceptionFunction · 0.85
VisitBitRunsFunction · 0.85
OKFunction · 0.50
dataMethod · 0.45
AppendValueMethod · 0.45
AppendNullsMethod · 0.45

Tested by

no test coverage detected