mapleFU commented on code in PR #39528:
URL: https://github.com/apache/arrow/pull/39528#discussion_r1468338070
##########
cpp/src/parquet/column_writer_test.cc:
##########
@@ -889,6 +895,45 @@ TEST_F(TestByteArrayValuesWriter, CheckDefaultStats) {
ASSERT_TRUE(this->metadata_is_stats_set());
}
+TEST(TestPageWriter, ThrowsOnPagesTooLarge) {
+ NodePtr item = schema::Int32("item"); // optional item
+ NodePtr list(GroupNode::Make("b", Repetition::REPEATED, {item},
ConvertedType::LIST));
+ NodePtr bag(GroupNode::Make("bag", Repetition::OPTIONAL, {list})); //
optional list
+ std::vector<NodePtr> fields = {bag};
+ NodePtr root = GroupNode::Make("schema", Repetition::REPEATED, fields);
+
+ SchemaDescriptor schema;
+ schema.Init(root);
+
+ auto sink = CreateOutputStream();
+ auto props = WriterProperties::Builder().build();
+
+ auto metadata = ColumnChunkMetaDataBuilder::Make(props, schema.Column(0));
+ std::unique_ptr<PageWriter> pager =
+ PageWriter::Open(sink, Compression::UNCOMPRESSED, metadata.get());
+
+ uint8_t data;
+ std::shared_ptr<Buffer> buffer =
+ std::make_shared<Buffer>(&data, std::numeric_limits<int32_t>::max() +
int64_t{1});
+ DataPageV1 over_compressed_limit(buffer, /*num_values=*/100,
Encoding::BIT_PACKED,
+ Encoding::BIT_PACKED, Encoding::BIT_PACKED,
+ /*uncompressed_size=*/100);
+ EXPECT_THAT([&]() { pager->WriteDataPage(over_compressed_limit); },
+ ThrowsMessage<ParquetException>(HasSubstr("overflows
INT32_MAX")));
+ DictionaryPage dictionary_over_compressed_limit(buffer, /*num_values=*/100,
+ Encoding::PLAIN);
+ EXPECT_THROW(pager->WriteDictionaryPage(dictionary_over_compressed_limit),
+ ParquetException);
Review Comment:
```suggestion
EXPECT_THAT([&]() {
pager->WriteDictionaryPage(dictionary_over_compressed_limit); },
ThrowsMessage<ParquetException>(HasSubstr("overflows
INT32_MAX")));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]