|
28 | 28 | #include <arrow/util/key_value_metadata.h> |
29 | 29 | #include <gtest/gtest.h> |
30 | 30 |
|
| 31 | +#include "iceberg/constants.h" |
31 | 32 | #include "iceberg/schema.h" |
32 | 33 | #include "iceberg/schema_internal.h" |
33 | 34 | #include "matchers.h" |
@@ -64,8 +65,8 @@ TEST_P(ToArrowSchemaTest, PrimitiveType) { |
64 | 65 | ASSERT_TRUE(field->type()->Equals(param.arrow_type)); |
65 | 66 |
|
66 | 67 | auto metadata = field->metadata(); |
67 | | - ASSERT_TRUE(metadata->Contains(kFieldIdKey)); |
68 | | - ASSERT_EQ(metadata->Get(kFieldIdKey), std::to_string(kFieldId)); |
| 68 | + ASSERT_TRUE(metadata->Contains(kParquetFieldIdKey)); |
| 69 | + ASSERT_EQ(metadata->Get(kParquetFieldIdKey), std::to_string(kFieldId)); |
69 | 70 | } |
70 | 71 |
|
71 | 72 | INSTANTIATE_TEST_SUITE_P( |
@@ -112,8 +113,8 @@ void CheckArrowField(const ::arrow::Field& field, ::arrow::Type::type type_id, |
112 | 113 |
|
113 | 114 | auto metadata = field.metadata(); |
114 | 115 | ASSERT_TRUE(metadata != nullptr); |
115 | | - ASSERT_TRUE(metadata->Contains(kFieldIdKey)); |
116 | | - ASSERT_EQ(metadata->Get(kFieldIdKey), std::to_string(field_id)); |
| 116 | + ASSERT_TRUE(metadata->Contains(kParquetFieldIdKey)); |
| 117 | + ASSERT_EQ(metadata->Get(kParquetFieldIdKey), std::to_string(field_id)); |
117 | 118 | } |
118 | 119 |
|
119 | 120 | } // namespace |
@@ -241,7 +242,7 @@ TEST_P(FromArrowSchemaTest, PrimitiveType) { |
241 | 242 |
|
242 | 243 | auto metadata = |
243 | 244 | ::arrow::key_value_metadata(std::unordered_map<std::string, std::string>{ |
244 | | - {std::string(kFieldIdKey), std::to_string(kFieldId)}}); |
| 245 | + {std::string(kParquetFieldIdKey), std::to_string(kFieldId)}}); |
245 | 246 | auto arrow_schema = ::arrow::schema({::arrow::field( |
246 | 247 | std::string(kFieldName), param.arrow_type, param.optional, std::move(metadata))}); |
247 | 248 | ArrowSchema exported_schema; |
@@ -309,16 +310,16 @@ TEST(FromArrowSchemaTest, StructType) { |
309 | 310 | auto int_field = ::arrow::field( |
310 | 311 | std::string(kIntFieldName), ::arrow::int32(), /*nullable=*/false, |
311 | 312 | ::arrow::key_value_metadata(std::unordered_map<std::string, std::string>{ |
312 | | - {std::string(kFieldIdKey), std::to_string(kIntFieldId)}})); |
| 313 | + {std::string(kParquetFieldIdKey), std::to_string(kIntFieldId)}})); |
313 | 314 | auto str_field = ::arrow::field( |
314 | 315 | std::string(kStrFieldName), ::arrow::utf8(), /*nullable=*/true, |
315 | 316 | ::arrow::key_value_metadata(std::unordered_map<std::string, std::string>{ |
316 | | - {std::string(kFieldIdKey), std::to_string(kStrFieldId)}})); |
| 317 | + {std::string(kParquetFieldIdKey), std::to_string(kStrFieldId)}})); |
317 | 318 | auto struct_type = ::arrow::struct_({int_field, str_field}); |
318 | 319 | auto struct_field = ::arrow::field( |
319 | 320 | std::string(kStructFieldName), struct_type, /*nullable=*/false, |
320 | 321 | ::arrow::key_value_metadata(std::unordered_map<std::string, std::string>{ |
321 | | - {std::string(kFieldIdKey), std::to_string(kStructFieldId)}})); |
| 322 | + {std::string(kParquetFieldIdKey), std::to_string(kStructFieldId)}})); |
322 | 323 | auto arrow_schema = ::arrow::schema({struct_field}); |
323 | 324 | ArrowSchema exported_schema; |
324 | 325 | ASSERT_TRUE(::arrow::ExportSchema(*arrow_schema, &exported_schema).ok()); |
@@ -363,12 +364,12 @@ TEST(FromArrowSchemaTest, ListType) { |
363 | 364 | auto element_field = ::arrow::field( |
364 | 365 | std::string(kElemFieldName), ::arrow::int64(), /*nullable=*/true, |
365 | 366 | ::arrow::key_value_metadata(std::unordered_map<std::string, std::string>{ |
366 | | - {std::string(kFieldIdKey), std::to_string(kElemFieldId)}})); |
| 367 | + {std::string(kParquetFieldIdKey), std::to_string(kElemFieldId)}})); |
367 | 368 | auto list_type = ::arrow::list(element_field); |
368 | 369 | auto list_field = ::arrow::field( |
369 | 370 | std::string(kListFieldName), list_type, /*nullable=*/false, |
370 | 371 | ::arrow::key_value_metadata(std::unordered_map<std::string, std::string>{ |
371 | | - {std::string(kFieldIdKey), std::to_string(kListFieldId)}})); |
| 372 | + {std::string(kParquetFieldIdKey), std::to_string(kListFieldId)}})); |
372 | 373 | auto arrow_schema = ::arrow::schema({list_field}); |
373 | 374 |
|
374 | 375 | ArrowSchema exported_schema; |
@@ -410,16 +411,16 @@ TEST(FromArrowSchemaTest, MapType) { |
410 | 411 | auto key_field = ::arrow::field( |
411 | 412 | std::string(kKeyFieldName), ::arrow::utf8(), /*nullable=*/false, |
412 | 413 | ::arrow::key_value_metadata(std::unordered_map<std::string, std::string>{ |
413 | | - {std::string(kFieldIdKey), std::to_string(kKeyFieldId)}})); |
| 414 | + {std::string(kParquetFieldIdKey), std::to_string(kKeyFieldId)}})); |
414 | 415 | auto value_field = ::arrow::field( |
415 | 416 | std::string(kValueFieldName), ::arrow::int32(), /*nullable=*/true, |
416 | 417 | ::arrow::key_value_metadata(std::unordered_map<std::string, std::string>{ |
417 | | - {std::string(kFieldIdKey), std::to_string(kValueFieldId)}})); |
| 418 | + {std::string(kParquetFieldIdKey), std::to_string(kValueFieldId)}})); |
418 | 419 | auto map_type = std::make_shared<::arrow::MapType>(key_field, value_field); |
419 | 420 | auto map_field = ::arrow::field( |
420 | 421 | std::string(kMapFieldName), map_type, /*nullable=*/true, |
421 | 422 | ::arrow::key_value_metadata(std::unordered_map<std::string, std::string>{ |
422 | | - {std::string(kFieldIdKey), std::to_string(kFieldId)}})); |
| 423 | + {std::string(kParquetFieldIdKey), std::to_string(kFieldId)}})); |
423 | 424 | auto arrow_schema = ::arrow::schema({map_field}); |
424 | 425 |
|
425 | 426 | ArrowSchema exported_schema; |
|
0 commit comments