| 1851 | } |
| 1852 | |
| 1853 | Status DecodeArrowDense(int num_values, int null_count, const uint8_t* valid_bits, |
| 1854 | int64_t valid_bits_offset, |
| 1855 | typename EncodingTraits<ByteArrayType>::Accumulator* out, |
| 1856 | int* out_num_values) { |
| 1857 | ARROW_ASSIGN_OR_RAISE( |
| 1858 | auto values_buffer, |
| 1859 | ::arrow::AllocateBuffer(sizeof(ByteArray) * (num_values - null_count), pool_)); |
| 1860 | auto values_data = values_buffer->template mutable_data_as<ByteArray>(); |
| 1861 | |
| 1862 | const int num_valid_values = Decode(values_data, num_values - null_count); |
| 1863 | if (ARROW_PREDICT_FALSE(num_values - null_count != num_valid_values)) { |
| 1864 | throw ParquetException("Expected to decode ", num_values - null_count, |
| 1865 | " values, but decoded ", num_valid_values, " values."); |
| 1866 | } |
| 1867 | |
| 1868 | auto visit_binary_helper = [&](auto* helper) { |
| 1869 | auto values_ptr = reinterpret_cast<const ByteArray*>(values_data); |
| 1870 | int value_idx = 0; |
| 1871 | |
| 1872 | RETURN_NOT_OK( |
| 1873 | VisitBitRuns(valid_bits, valid_bits_offset, num_values, |
| 1874 | [&](int64_t position, int64_t run_length, bool is_valid) { |
| 1875 | if (is_valid) { |
| 1876 | for (int64_t i = 0; i < run_length; ++i) { |
| 1877 | const auto& val = values_ptr[value_idx]; |
| 1878 | RETURN_NOT_OK(helper->AppendValue( |
| 1879 | val.ptr, static_cast<int32_t>(val.len))); |
| 1880 | ++value_idx; |
| 1881 | } |
| 1882 | return Status::OK(); |
| 1883 | } else { |
| 1884 | return helper->AppendNulls(run_length); |
| 1885 | } |
| 1886 | })); |
| 1887 | *out_num_values = num_valid_values; |
| 1888 | return Status::OK(); |
| 1889 | }; |
| 1890 | return DispatchArrowBinaryHelper<ByteArrayType>( |
| 1891 | out, num_values, /*estimated_data_length=*/{}, visit_binary_helper); |
| 1892 | } |
| 1893 | |
| 1894 | MemoryPool* pool_; |
| 1895 | std::shared_ptr<::arrow::bit_util::BitReader> decoder_; |
nothing calls this directly
no test coverage detected