| 1802 | } |
| 1803 | |
| 1804 | Status DecodeArrowDense(int num_values, int null_count, const uint8_t* valid_bits, |
| 1805 | int64_t valid_bits_offset, |
| 1806 | typename EncodingTraits<ByteArrayType>::Accumulator* out, |
| 1807 | int* out_num_values) { |
| 1808 | ARROW_ASSIGN_OR_RAISE( |
| 1809 | auto values_buffer, |
| 1810 | ::arrow::AllocateBuffer(sizeof(ByteArray) * (num_values - null_count), pool_)); |
| 1811 | auto values_data = values_buffer->template mutable_data_as<ByteArray>(); |
| 1812 | |
| 1813 | const int num_valid_values = Decode(values_data, num_values - null_count); |
| 1814 | if (ARROW_PREDICT_FALSE(num_values - null_count != num_valid_values)) { |
| 1815 | throw ParquetException("Expected to decode ", num_values - null_count, |
| 1816 | " values, but decoded ", num_valid_values, " values."); |
| 1817 | } |
| 1818 | |
| 1819 | auto visit_binary_helper = [&](auto* helper) { |
| 1820 | auto values_ptr = reinterpret_cast<const ByteArray*>(values_data); |
| 1821 | int value_idx = 0; |
| 1822 | |
| 1823 | RETURN_NOT_OK( |
| 1824 | VisitBitRuns(valid_bits, valid_bits_offset, num_values, |
| 1825 | [&](int64_t position, int64_t run_length, bool is_valid) { |
| 1826 | if (is_valid) { |
| 1827 | for (int64_t i = 0; i < run_length; ++i) { |
| 1828 | const auto& val = values_ptr[value_idx]; |
| 1829 | RETURN_NOT_OK(helper->AppendValue( |
| 1830 | val.ptr, static_cast<int32_t>(val.len))); |
| 1831 | ++value_idx; |
| 1832 | } |
| 1833 | return Status::OK(); |
| 1834 | } else { |
| 1835 | return helper->AppendNulls(run_length); |
| 1836 | } |
| 1837 | })); |
| 1838 | *out_num_values = num_valid_values; |
| 1839 | return Status::OK(); |
| 1840 | }; |
| 1841 | return DispatchArrowBinaryHelper<ByteArrayType>( |
| 1842 | out, num_values, /*estimated_data_length=*/{}, visit_binary_helper); |
| 1843 | } |
| 1844 | |
| 1845 | MemoryPool* pool_; |
| 1846 | std::shared_ptr<::arrow::bit_util::BitReader> decoder_; |
nothing calls this directly
no test coverage detected