| 371 | template <typename Tuple, std::size_t N = std::tuple_size<Tuple>::value> |
| 372 | struct EnsureColumnTypes { |
| 373 | static Status Cast(const Table& table, std::shared_ptr<Table>* table_owner, |
| 374 | const compute::CastOptions& cast_options, compute::ExecContext* ctx, |
| 375 | std::reference_wrapper<const ::arrow::Table>* result) { |
| 376 | using Element = BareTupleElement<N - 1, Tuple>; |
| 377 | std::shared_ptr<DataType> expected_type = ConversionTraits<Element>::type_singleton(); |
| 378 | |
| 379 | if (!table.schema()->field(N - 1)->type()->Equals(*expected_type)) { |
| 380 | ARROW_ASSIGN_OR_RAISE( |
| 381 | Datum casted, |
| 382 | compute::Cast(table.column(N - 1), expected_type, cast_options, ctx)); |
| 383 | auto new_field = table.schema()->field(N - 1)->WithType(expected_type); |
| 384 | ARROW_ASSIGN_OR_RAISE(*table_owner, |
| 385 | table.SetColumn(N - 1, new_field, casted.chunked_array())); |
| 386 | *result = **table_owner; |
| 387 | } |
| 388 | |
| 389 | return EnsureColumnTypes<Tuple, N - 1>::Cast(result->get(), table_owner, cast_options, |
| 390 | ctx, result); |
| 391 | } |
| 392 | }; |
| 393 | |
| 394 | template <typename Tuple> |
nothing calls this directly
no test coverage detected