Skip to content

Commit 064d065

Browse files
shangxinliclaude
andcommitted
test: add buffer size configuration test
Validate that the Avro buffer size can be configured via: - Set() method with custom value - FromMap() with configuration map - Unset() to return to default 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent b63b9de commit 064d065

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎src/iceberg/test/avro_test.cc‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,4 +503,27 @@ INSTANTIATE_TEST_SUITE_P(DirectDecoderModes, AvroReaderParameterizedTest,
503503
return info.param ? "DirectDecoder" : "GenericDatum";
504504
});
505505

506+
TEST_F(AvroReaderTest, BufferSizeConfiguration) {
507+
// Test default buffer size
508+
auto properties1 = ReaderProperties::default_properties();
509+
ASSERT_EQ(properties1->Get(ReaderProperties::kAvroBufferSize), 1024 * 1024);
510+
511+
// Test setting custom buffer size
512+
auto properties2 = ReaderProperties::default_properties();
513+
constexpr int64_t kCustomBufferSize = 2 * 1024 * 1024; // 2MB
514+
properties2->Set(ReaderProperties::kAvroBufferSize, kCustomBufferSize);
515+
ASSERT_EQ(properties2->Get(ReaderProperties::kAvroBufferSize), kCustomBufferSize);
516+
517+
// Test setting via FromMap
518+
std::unordered_map<std::string, std::string> config_map = {
519+
{"read.avro.buffer-size", "4194304"} // 4MB
520+
};
521+
auto properties3 = ReaderProperties::FromMap(config_map);
522+
ASSERT_EQ(properties3->Get(ReaderProperties::kAvroBufferSize), 4194304);
523+
524+
// Test that unset returns to default
525+
properties2->Unset(ReaderProperties::kAvroBufferSize);
526+
ASSERT_EQ(properties2->Get(ReaderProperties::kAvroBufferSize), 1024 * 1024);
527+
}
528+
506529
} // namespace iceberg::avro

0 commit comments

Comments
 (0)