From c51d869cc445bc2bb2e773de123d891f76dc79a0 Mon Sep 17 00:00:00 2001 From: Alexey Zatelepin Date: Tue, 7 Jan 2025 23:42:02 +0100 Subject: [PATCH] datalake: test new partition key serde in iceberg_file_committer utest --- .../tests/iceberg_file_committer_test.cc | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/v/datalake/coordinator/tests/iceberg_file_committer_test.cc b/src/v/datalake/coordinator/tests/iceberg_file_committer_test.cc index 897ed482e3665..5a431651edebe 100644 --- a/src/v/datalake/coordinator/tests/iceberg_file_committer_test.cc +++ b/src/v/datalake/coordinator/tests/iceberg_file_committer_test.cc @@ -215,13 +215,28 @@ TEST_F(FileCommitterTest, TestFilesGetPartitionKey) { std::move(offsets), }, added_at_counter++); + + bool first = true; for (auto& e : t_state.pid_to_pending_files[model::partition_id{0}] .pending_entries) { - e.data.files.emplace_back(datalake::coordinator::data_file{ + datalake::coordinator::data_file file{ .row_count = 100, .file_size_bytes = 1024, - .hour_deprecated = hour, - }); + }; + + if (first) { + // for the first file, add partition info in the legacy format + file.hour_deprecated = hour; + first = false; + } else { + chunked_vector> pk; + pk.push_back(value_to_bytes(int_value{hour})); + file.table_schema_id = 0; + file.partition_spec_id = 0; + file.partition_key = std::move(pk); + } + + e.data.files.emplace_back(std::move(file)); } state.topic_to_state[topic] = std::move(t_state); return state;