Skip to content

Commit 89410b3

Browse files
committed
fix arrow uuid extension type
1 parent 36b01c5 commit 89410b3

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/iceberg/parquet/parquet_schema_util.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <charconv>
2121

22+
#include <arrow/extension_type.h>
2223
#include <arrow/type.h>
2324
#include <arrow/type_fwd.h>
2425
#include <arrow/util/key_value_metadata.h>
@@ -151,10 +152,10 @@ Status ValidateParquetSchemaEvolution(
151152
}
152153
break;
153154
case TypeId::kUuid:
154-
if (arrow_type->id() == ::arrow::Type::FIXED_SIZE_BINARY) {
155-
const auto& fixed_binary =
156-
internal::checked_cast<const ::arrow::FixedSizeBinaryType&>(*arrow_type);
157-
if (fixed_binary.byte_width() == 16) {
155+
if (arrow_type->id() == ::arrow::Type::EXTENSION) {
156+
const auto& extension_type =
157+
internal::checked_cast<const ::arrow::ExtensionType&>(*arrow_type);
158+
if (extension_type.extension_name() == "arrow.uuid") {
158159
return {};
159160
}
160161
}
@@ -213,7 +214,7 @@ Result<FieldProjection> ProjectStruct(
213214
if (!field_id) {
214215
continue;
215216
}
216-
if (const auto [iter, inserted] = field_context_map.emplace(
217+
if (const auto& [_, inserted] = field_context_map.emplace(
217218
std::piecewise_construct, std::forward_as_tuple(field_id.value()),
218219
std::forward_as_tuple(i, parquet_field));
219220
!inserted) [[unlikely]] {

test/parquet_schema_test.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,13 @@ ::parquet::arrow::SchemaManifest MakeSchemaManifest(
110110
auto parquet_schema_descriptor = std::make_shared<::parquet::SchemaDescriptor>();
111111
parquet_schema_descriptor->Init(parquet_schema);
112112

113+
auto properties = ::parquet::default_arrow_reader_properties();
114+
properties.set_arrow_extensions_enabled(true);
115+
113116
::parquet::arrow::SchemaManifest manifest;
114-
auto status = ::parquet::arrow::SchemaManifest::Make(
115-
parquet_schema_descriptor.get(), /*key_value_metadata=*/nullptr,
116-
::parquet::default_arrow_reader_properties(), &manifest);
117+
auto status = ::parquet::arrow::SchemaManifest::Make(parquet_schema_descriptor.get(),
118+
/*key_value_metadata=*/nullptr,
119+
properties, &manifest);
117120
if (!status.ok()) {
118121
throw std::runtime_error("Failed to create SchemaManifest: " + status.ToString());
119122
}

0 commit comments

Comments
 (0)