| 196 | /// restrict the types that are considered fixed-width |
| 197 | template <class ExtraPred> |
| 198 | inline bool IsFixedWidthLike(const ArraySpan& source, bool force_null_count, |
| 199 | ExtraPred extra_predicate) { |
| 200 | const auto* type = source.type; |
| 201 | // BOOL is considered fixed-width if not nested under FIXED_SIZE_LIST. |
| 202 | if (is_fixed_width(type->id()) && extra_predicate(*type)) { |
| 203 | return true; |
| 204 | } |
| 205 | if (type->id() == Type::FIXED_SIZE_LIST) { |
| 206 | // All the inner arrays must not contain any nulls. |
| 207 | const auto* values = &source.child_data[0]; |
| 208 | while ((force_null_count ? values->GetNullCount() : values->null_count) == 0) { |
| 209 | type = values->type; |
| 210 | if (type->id() == Type::FIXED_SIZE_LIST) { |
| 211 | values = &values->child_data[0]; |
| 212 | continue; |
| 213 | } |
| 214 | return is_fixed_width(type->id()) && extra_predicate(*type); |
| 215 | } |
| 216 | } |
| 217 | return false; |
| 218 | } |
| 219 | |
| 220 | /// \brief Get the fixed-width in bytes of a type if it is a fixed-width like |
| 221 | /// type, but not BOOL. |