Skip to content

Commit 7432b45

Browse files
committed
fix: review comment
1 parent a514d4f commit 7432b45

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

‎src/iceberg/test/avro_test.cc‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,33 @@ TEST_P(AvroWriterTest, WriteUuidMapType) {
984984
ASSERT_NO_FATAL_FAILURE(WriteArrowArrayAndVerify(schema, array));
985985
}
986986

987+
TEST_P(AvroWriterTest, WriteUuidMapKeyType) {
988+
auto schema = std::make_shared<iceberg::Schema>(
989+
std::vector<SchemaField>{SchemaField::MakeRequired(
990+
1, "uuid_key_map",
991+
std::make_shared<MapType>(
992+
SchemaField::MakeRequired(2, MapType::kKeyName, iceberg::uuid()),
993+
SchemaField::MakeRequired(3, MapType::kValueName, iceberg::string())))});
994+
995+
auto map_offsets = MakeInt32Array({0, 2, 3});
996+
auto map_keys = MakeUuidArray({&kUuidBytes1, &kUuidBytes2, &kUuidBytes1});
997+
auto map_items = MakeStringArray({"first", "second", "only"});
998+
auto map_type =
999+
::arrow::map(::arrow::extension::uuid(),
1000+
::arrow::field(std::string(MapType::kValueName), ::arrow::utf8(),
1001+
/*nullable=*/false));
1002+
auto map_array =
1003+
::arrow::MapArray::FromArrays(map_type, map_offsets, map_keys, map_items)
1004+
.ValueOrDie();
1005+
1006+
auto array =
1007+
::arrow::StructArray::Make(
1008+
{map_array}, {::arrow::field("uuid_key_map", map_type, /*nullable=*/false)})
1009+
.ValueOrDie();
1010+
1011+
ASSERT_NO_FATAL_FAILURE(WriteArrowArrayAndVerify(schema, array));
1012+
}
1013+
9871014
TEST_P(AvroWriterTest, WriteTemporalTypes) {
9881015
auto schema = std::make_shared<iceberg::Schema>(std::vector<SchemaField>{
9891016
SchemaField::MakeRequired(1, "date_col", std::make_shared<DateType>()),

0 commit comments

Comments
 (0)