wgtmac commented on code in PR #48692:
URL: https://github.com/apache/arrow/pull/48692#discussion_r2666936109
##########
cpp/src/parquet/column_writer_test.cc:
##########
@@ -2380,5 +2381,87 @@ TYPED_TEST(TestColumnWriterMaxRowsPerPage,
RequiredLargeChunk) {
}
}
+class TestArrowWriteSerialize : public ::testing::Test {
+ public:
+ void SetUp() {
+ // Create a Parquet schema
+ // Int8 maps to Int32 in Parquet with INT_8 converted type
+ auto node = schema::PrimitiveNode::Make("int8_col", Repetition::OPTIONAL,
Type::INT32,
+ ConvertedType::INT_8);
+ schema_descriptor_ = std::make_shared<ColumnDescriptor>(node, 1, 0);
+ sink_ = CreateOutputStream();
+ writer_properties_ = default_writer_properties();
+ }
+
+ std::shared_ptr<TypedColumnWriter<Int32Type>> BuildWriter() {
+ metadata_ =
+ ColumnChunkMetaDataBuilder::Make(writer_properties_,
schema_descriptor_.get());
+ std::unique_ptr<PageWriter> pager =
+ PageWriter::Open(sink_, Compression::UNCOMPRESSED, metadata_.get());
+ std::shared_ptr<ColumnWriter> writer =
+ ColumnWriter::Make(metadata_.get(), std::move(pager),
writer_properties_.get());
+ return std::static_pointer_cast<TypedColumnWriter<Int32Type>>(writer);
+ }
+
+ std::shared_ptr<TypedColumnReader<Int32Type>> BuildReader(int64_t num_rows) {
+ EXPECT_OK_AND_ASSIGN(auto buffer, sink_->Finish());
+ auto source = std::make_shared<::arrow::io::BufferReader>(buffer);
+ ReaderProperties reader_properties;
+ std::unique_ptr<PageReader> page_reader = PageReader::Open(
+ std::move(source), num_rows, Compression::UNCOMPRESSED,
reader_properties);
+ std::shared_ptr<ColumnReader> reader =
+ ColumnReader::Make(schema_descriptor_.get(), std::move(page_reader));
+ return std::static_pointer_cast<TypedColumnReader<Int32Type>>(reader);
+ }
+
+ protected:
+ std::shared_ptr<ColumnDescriptor> schema_descriptor_;
+ std::shared_ptr<::arrow::io::BufferOutputStream> sink_;
+ std::shared_ptr<WriterProperties> writer_properties_;
+ std::unique_ptr<ColumnChunkMetaDataBuilder> metadata_;
+};
+
+TEST_F(TestArrowWriteSerialize, AllNulls) {
+ std::shared_ptr<::arrow::Buffer> null_bitmap;
+ ASSERT_OK_AND_ASSIGN(null_bitmap, ::arrow::AllocateBitmap(100));
+ // Set all bits to 0 (null)
+ ::arrow::bit_util::SetBitsTo(null_bitmap->mutable_data(), 0, 100, false);
+
+ std::shared_ptr<::arrow::Buffer> data_buffer = nullptr;
Review Comment:
cc @pitrou as this is somehow related to
https://github.com/apache/arrow/issues/48560
--
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]