|
23 | 23 | #include <arrow/array/builder_decimal.h> |
24 | 24 | #include <arrow/array/builder_nested.h> |
25 | 25 | #include <arrow/array/builder_primitive.h> |
| 26 | +#include <arrow/extension_type.h> |
26 | 27 | #include <arrow/json/from_string.h> |
27 | 28 | #include <arrow/type.h> |
28 | 29 | #include <arrow/util/decimal.h> |
@@ -536,9 +537,7 @@ Status ExtractDatumFromArray(const ::arrow::Array& array, int64_t index, |
536 | 537 | internal::checked_cast<const ::arrow::FixedSizeBinaryArray&>(array); |
537 | 538 | std::string_view value = fixed_array.GetView(index); |
538 | 539 | auto& fixed_datum = datum->value<::avro::GenericFixed>(); |
539 | | - fixed_datum.value().assign( |
540 | | - reinterpret_cast<const char*>(value.data()), |
541 | | - reinterpret_cast<const char*>(value.data()) + value.size()); |
| 540 | + fixed_datum.value().assign(value.begin(), value.end()); |
542 | 541 | return {}; |
543 | 542 | } |
544 | 543 |
|
@@ -573,7 +572,21 @@ Status ExtractDatumFromArray(const ::arrow::Array& array, int64_t index, |
573 | 572 | return {}; |
574 | 573 | } |
575 | 574 |
|
576 | | - // TODO(gangwu): support uuid type. |
| 575 | + case ::arrow::Type::EXTENSION: { |
| 576 | + if (array.type()->name() == "arrow.uuid") { |
| 577 | + const auto& extension_array = |
| 578 | + internal::checked_cast<const ::arrow::ExtensionArray&>(array); |
| 579 | + const auto& fixed_array = |
| 580 | + internal::checked_cast<const ::arrow::FixedSizeBinaryArray&>( |
| 581 | + *extension_array.storage()); |
| 582 | + std::string_view value = fixed_array.GetView(index); |
| 583 | + auto& fixed_datum = datum->value<::avro::GenericFixed>(); |
| 584 | + fixed_datum.value().assign(value.begin(), value.end()); |
| 585 | + return {}; |
| 586 | + } |
| 587 | + |
| 588 | + return NotSupported("Unsupported Arrow extension type: {}", array.type()->name()); |
| 589 | + } |
577 | 590 |
|
578 | 591 | case ::arrow::Type::STRUCT: { |
579 | 592 | const auto& struct_array = |
|
0 commit comments