| 1687 | |
| 1688 | template <typename T> |
| 1689 | enable_if_decimal<T, Status> Visit(const T& type) { |
| 1690 | typename TypeTraits<T>::BuilderType builder(type_, pool_); |
| 1691 | |
| 1692 | ARROW_ASSIGN_OR_RAISE(const auto json_data_arr, GetDataArray(obj_)); |
| 1693 | if (static_cast<int64_t>(json_data_arr.size()) != length_) { |
| 1694 | return Status::Invalid("Integer array had unexpected length ", json_data_arr.size(), |
| 1695 | " (expected ", length_, ")"); |
| 1696 | } |
| 1697 | |
| 1698 | for (auto [is_valid, val] : Zip(is_valid_, json_data_arr)) { |
| 1699 | if (!is_valid) { |
| 1700 | RETURN_NOT_OK(builder.AppendNull()); |
| 1701 | continue; |
| 1702 | } |
| 1703 | |
| 1704 | ARROW_ASSIGN_OR_RAISE(auto string, |
| 1705 | internal::ResolveSimdjsonResult( |
| 1706 | val.get_string(), "Expected decimal value as string")); |
| 1707 | |
| 1708 | DCHECK_GT(string.size(), 0) << "Empty string found when parsing Decimal128 value"; |
| 1709 | |
| 1710 | using Value = typename TypeTraits<T>::ScalarType::ValueType; |
| 1711 | ARROW_ASSIGN_OR_RAISE(Value decimal_val, Value::FromString(string)); |
| 1712 | RETURN_NOT_OK(builder.Append(decimal_val)); |
| 1713 | } |
| 1714 | |
| 1715 | return FinishBuilder(&builder); |
| 1716 | } |
| 1717 | |
| 1718 | template <typename T> |
| 1719 | Status GetIntArray(const JsonArray& json_array, const int32_t length, |
no test coverage detected