|
29 | 29 | #include <gtest/gtest.h> |
30 | 30 |
|
31 | 31 | #include "iceberg/arrow_c_data_internal.h" |
| 32 | +#include "iceberg/constants.h" |
32 | 33 | #include "iceberg/schema.h" |
33 | 34 | #include "iceberg/schema_internal.h" |
34 | 35 | #include "matchers.h" |
@@ -98,8 +99,8 @@ TEST_P(ToArrowSchemaTest, PrimitiveType) { |
98 | 99 | ASSERT_TRUE(field->type()->Equals(param.arrow_type)); |
99 | 100 |
|
100 | 101 | auto metadata = field->metadata(); |
101 | | - ASSERT_TRUE(metadata->Contains(kFieldIdKey)); |
102 | | - ASSERT_EQ(metadata->Get(kFieldIdKey), std::to_string(kFieldId)); |
| 102 | + ASSERT_TRUE(metadata->Contains(kParquetFieldIdKey)); |
| 103 | + ASSERT_EQ(metadata->Get(kParquetFieldIdKey), std::to_string(kFieldId)); |
103 | 104 | } |
104 | 105 |
|
105 | 106 | INSTANTIATE_TEST_SUITE_P( |
@@ -146,8 +147,8 @@ void CheckArrowField(const ::arrow::Field& field, ::arrow::Type::type type_id, |
146 | 147 |
|
147 | 148 | auto metadata = field.metadata(); |
148 | 149 | ASSERT_TRUE(metadata != nullptr); |
149 | | - ASSERT_TRUE(metadata->Contains(kFieldIdKey)); |
150 | | - ASSERT_EQ(metadata->Get(kFieldIdKey), std::to_string(field_id)); |
| 150 | + ASSERT_TRUE(metadata->Contains(kParquetFieldIdKey)); |
| 151 | + ASSERT_EQ(metadata->Get(kParquetFieldIdKey), std::to_string(field_id)); |
151 | 152 | } |
152 | 153 |
|
153 | 154 | } // namespace |
@@ -275,7 +276,7 @@ TEST_P(FromArrowSchemaTest, PrimitiveType) { |
275 | 276 |
|
276 | 277 | auto metadata = |
277 | 278 | ::arrow::key_value_metadata(std::unordered_map<std::string, std::string>{ |
278 | | - {std::string(kFieldIdKey), std::to_string(kFieldId)}}); |
| 279 | + {std::string(kParquetFieldIdKey), std::to_string(kFieldId)}}); |
279 | 280 | auto arrow_schema = ::arrow::schema({::arrow::field( |
280 | 281 | std::string(kFieldName), param.arrow_type, param.optional, std::move(metadata))}); |
281 | 282 | ArrowSchema exported_schema; |
@@ -343,16 +344,16 @@ TEST(FromArrowSchemaTest, StructType) { |
343 | 344 | auto int_field = ::arrow::field( |
344 | 345 | std::string(kIntFieldName), ::arrow::int32(), /*nullable=*/false, |
345 | 346 | ::arrow::key_value_metadata(std::unordered_map<std::string, std::string>{ |
346 | | - {std::string(kFieldIdKey), std::to_string(kIntFieldId)}})); |
| 347 | + {std::string(kParquetFieldIdKey), std::to_string(kIntFieldId)}})); |
347 | 348 | auto str_field = ::arrow::field( |
348 | 349 | std::string(kStrFieldName), ::arrow::utf8(), /*nullable=*/true, |
349 | 350 | ::arrow::key_value_metadata(std::unordered_map<std::string, std::string>{ |
350 | | - {std::string(kFieldIdKey), std::to_string(kStrFieldId)}})); |
| 351 | + {std::string(kParquetFieldIdKey), std::to_string(kStrFieldId)}})); |
351 | 352 | auto struct_type = ::arrow::struct_({int_field, str_field}); |
352 | 353 | auto struct_field = ::arrow::field( |
353 | 354 | std::string(kStructFieldName), struct_type, /*nullable=*/false, |
354 | 355 | ::arrow::key_value_metadata(std::unordered_map<std::string, std::string>{ |
355 | | - {std::string(kFieldIdKey), std::to_string(kStructFieldId)}})); |
| 356 | + {std::string(kParquetFieldIdKey), std::to_string(kStructFieldId)}})); |
356 | 357 | auto arrow_schema = ::arrow::schema({struct_field}); |
357 | 358 | ArrowSchema exported_schema; |
358 | 359 | ASSERT_TRUE(::arrow::ExportSchema(*arrow_schema, &exported_schema).ok()); |
@@ -397,12 +398,12 @@ TEST(FromArrowSchemaTest, ListType) { |
397 | 398 | auto element_field = ::arrow::field( |
398 | 399 | std::string(kElemFieldName), ::arrow::int64(), /*nullable=*/true, |
399 | 400 | ::arrow::key_value_metadata(std::unordered_map<std::string, std::string>{ |
400 | | - {std::string(kFieldIdKey), std::to_string(kElemFieldId)}})); |
| 401 | + {std::string(kParquetFieldIdKey), std::to_string(kElemFieldId)}})); |
401 | 402 | auto list_type = ::arrow::list(element_field); |
402 | 403 | auto list_field = ::arrow::field( |
403 | 404 | std::string(kListFieldName), list_type, /*nullable=*/false, |
404 | 405 | ::arrow::key_value_metadata(std::unordered_map<std::string, std::string>{ |
405 | | - {std::string(kFieldIdKey), std::to_string(kListFieldId)}})); |
| 406 | + {std::string(kParquetFieldIdKey), std::to_string(kListFieldId)}})); |
406 | 407 | auto arrow_schema = ::arrow::schema({list_field}); |
407 | 408 |
|
408 | 409 | ArrowSchema exported_schema; |
@@ -444,16 +445,16 @@ TEST(FromArrowSchemaTest, MapType) { |
444 | 445 | auto key_field = ::arrow::field( |
445 | 446 | std::string(kKeyFieldName), ::arrow::utf8(), /*nullable=*/false, |
446 | 447 | ::arrow::key_value_metadata(std::unordered_map<std::string, std::string>{ |
447 | | - {std::string(kFieldIdKey), std::to_string(kKeyFieldId)}})); |
| 448 | + {std::string(kParquetFieldIdKey), std::to_string(kKeyFieldId)}})); |
448 | 449 | auto value_field = ::arrow::field( |
449 | 450 | std::string(kValueFieldName), ::arrow::int32(), /*nullable=*/true, |
450 | 451 | ::arrow::key_value_metadata(std::unordered_map<std::string, std::string>{ |
451 | | - {std::string(kFieldIdKey), std::to_string(kValueFieldId)}})); |
| 452 | + {std::string(kParquetFieldIdKey), std::to_string(kValueFieldId)}})); |
452 | 453 | auto map_type = std::make_shared<::arrow::MapType>(key_field, value_field); |
453 | 454 | auto map_field = ::arrow::field( |
454 | 455 | std::string(kMapFieldName), map_type, /*nullable=*/true, |
455 | 456 | ::arrow::key_value_metadata(std::unordered_map<std::string, std::string>{ |
456 | | - {std::string(kFieldIdKey), std::to_string(kFieldId)}})); |
| 457 | + {std::string(kParquetFieldIdKey), std::to_string(kFieldId)}})); |
457 | 458 | auto arrow_schema = ::arrow::schema({map_field}); |
458 | 459 |
|
459 | 460 | ArrowSchema exported_schema; |
|
0 commit comments