@@ -47,10 +47,9 @@ TEST(ParquetRewriterTest, SimpleRoundTrip) {
4747 auto schema = ::arrow::schema (
4848 {::arrow::field (" a" , ::arrow::int32 ()), ::arrow::field (" b" , ::arrow::utf8 ())});
4949
50- std::shared_ptr<Buffer> buffer;
51-
52- WriteFile (rewriter_properties->writer_properties (),
53- ::arrow::TableFromJSON (schema, {R"( [[1, "a"], [2, "b"]])" }), buffer);
50+ ASSERT_OK_AND_ASSIGN (auto buffer, WriteFile (rewriter_properties->writer_properties (),
51+ ::arrow::TableFromJSON (
52+ schema, {R"( [[1, "a"], [2, "b"]])" })));
5453
5554 auto sink = CreateOutputStream ();
5655 auto rewriter =
@@ -81,13 +80,13 @@ TEST(ParquetRewriterTest, ConcatRoundTrip) {
8180 auto schema = ::arrow::schema (
8281 {::arrow::field (" a" , ::arrow::int32 ()), ::arrow::field (" b" , ::arrow::utf8 ())});
8382
84- std::shared_ptr<Buffer> buffer_up;
85- std::shared_ptr<Buffer> buffer_down;
86-
87- WriteFile (rewriter_properties-> writer_properties (),
88- ::arrow::TableFromJSON (schema, { R"( [[1, "a"], [2, "b"]] )" }), buffer_up);
89- WriteFile (rewriter_properties->writer_properties (),
90- ::arrow::TableFromJSON (schema, {R"( [[3, "c"]])" }), buffer_down );
83+ ASSERT_OK_AND_ASSIGN (
84+ auto buffer_up,
85+ WriteFile (rewriter_properties-> writer_properties (),
86+ ::arrow::TableFromJSON (schema, { R"( [[1, "a"], [2, "b"]] )" })));
87+ ASSERT_OK_AND_ASSIGN ( auto buffer_down,
88+ WriteFile (rewriter_properties->writer_properties (),
89+ ::arrow::TableFromJSON (schema, {R"( [[3, "c"]])" })) );
9190
9291 auto sink = CreateOutputStream ();
9392 auto rewriter =
@@ -121,15 +120,15 @@ TEST(ParquetRewriterTest, JoinRoundTrip) {
121120 {::arrow::field (" a" , ::arrow::int32 ()), ::arrow::field (" b" , ::arrow::utf8 ())});
122121 auto right_schema = ::arrow::schema ({::arrow::field (" c" , ::arrow::int64 ())});
123122
124- std::shared_ptr<Buffer> buffer_left;
125- std::shared_ptr<Buffer> buffer_right;
126-
127- WriteFile ( rewriter_properties->writer_properties (),
128- ::arrow::TableFromJSON (left_schema, {R"( [[1, "a"], [2, "b"], [3, "c"]])" }),
129- buffer_left);
130- WriteFile (rewriter_properties-> writer_properties () ,
131- ::arrow::TableFromJSON (right_schema, { R"( [[10], [20], [30]] )" } ),
132- buffer_right );
123+ ASSERT_OK_AND_ASSIGN (
124+ auto buffer_left,
125+ WriteFile (
126+ rewriter_properties->writer_properties (),
127+ ::arrow::TableFromJSON (left_schema, {R"( [[1, "a"], [2, "b"], [3, "c"]])" })));
128+ ASSERT_OK_AND_ASSIGN (
129+ auto buffer_right ,
130+ WriteFile (rewriter_properties-> writer_properties ( ),
131+ ::arrow::TableFromJSON (right_schema, { R"( [[10], [20], [30]] )" })) );
133132
134133 auto sink = CreateOutputStream ();
135134 auto rewriter = ParquetFileRewriter::Open (
@@ -167,18 +166,17 @@ TEST(ParquetRewriterTest, ConcatJoinRoundTrip) {
167166 {::arrow::field (" a" , ::arrow::int32 ()), ::arrow::field (" b" , ::arrow::utf8 ())});
168167 auto right_schema = ::arrow::schema ({::arrow::field (" c" , ::arrow::int64 ())});
169168
170- std::shared_ptr<Buffer> buffer_left_up;
171- std::shared_ptr<Buffer> buffer_left_down;
172- std::shared_ptr<Buffer> buffer_right;
173-
174- WriteFile (rewriter_properties->writer_properties (),
175- ::arrow::TableFromJSON (left_schema, {R"( [[1, "a"], [2, "b"]])" }),
176- buffer_left_up);
177- WriteFile (rewriter_properties->writer_properties (),
178- ::arrow::TableFromJSON (left_schema, {R"( [[3, "c"]])" }), buffer_left_down);
179- WriteFile (rewriter_properties->writer_properties (),
180- ::arrow::TableFromJSON (right_schema, {R"( [[10], [20], [30]])" }),
181- buffer_right);
169+ ASSERT_OK_AND_ASSIGN (
170+ auto buffer_left_up,
171+ WriteFile (rewriter_properties->writer_properties (),
172+ ::arrow::TableFromJSON (left_schema, {R"( [[1, "a"], [2, "b"]])" })));
173+ ASSERT_OK_AND_ASSIGN (auto buffer_left_down,
174+ WriteFile (rewriter_properties->writer_properties (),
175+ ::arrow::TableFromJSON (left_schema, {R"( [[3, "c"]])" })));
176+ ASSERT_OK_AND_ASSIGN (
177+ auto buffer_right,
178+ WriteFile (rewriter_properties->writer_properties (),
179+ ::arrow::TableFromJSON (right_schema, {R"( [[10], [20], [30]])" })));
182180
183181 auto sink = CreateOutputStream ();
184182 auto rewriter = ParquetFileRewriter::Open (
@@ -212,23 +210,23 @@ TEST(ParquetRewriterTest, JoinRowCountsMismatch) {
212210 WriterProperties::Builder ().enable_write_page_index ()->build ())
213211 ->build ();
214212
215- auto schema1 = ::arrow::schema ({::arrow::field (" a" , ::arrow::int32 ())});
216- auto schema2 = ::arrow::schema ({::arrow::field (" b" , ::arrow::int32 ())});
217-
218- std::shared_ptr<Buffer> buffer1;
219- std::shared_ptr<Buffer> buffer2;
213+ auto left_schema = ::arrow::schema ({::arrow::field (" a" , ::arrow::int32 ())});
214+ auto right_schema = ::arrow::schema ({::arrow::field (" b" , ::arrow::int32 ())});
220215
221- WriteFile (rewriter_properties->writer_properties (),
222- ::arrow::TableFromJSON (schema1, {R"( [[1], [2]])" }), buffer1);
223- WriteFile (rewriter_properties->writer_properties (),
224- ::arrow::TableFromJSON (schema2, {R"( [[3], [4], [5]])" }), buffer2);
216+ ASSERT_OK_AND_ASSIGN (auto buffer_left,
217+ WriteFile (rewriter_properties->writer_properties (),
218+ ::arrow::TableFromJSON (left_schema, {R"( [[1], [2]])" })));
219+ ASSERT_OK_AND_ASSIGN (
220+ auto buffer_right,
221+ WriteFile (rewriter_properties->writer_properties (),
222+ ::arrow::TableFromJSON (right_schema, {R"( [[3], [4], [5]])" })));
225223
226224 auto sink = CreateOutputStream ();
227225
228226 EXPECT_THROW_THAT (
229227 [&]() {
230- ParquetFileRewriter::Open ({{std::make_shared<BufferReader>(buffer1 )},
231- {std::make_shared<BufferReader>(buffer2 )}},
228+ ParquetFileRewriter::Open ({{std::make_shared<BufferReader>(buffer_left )},
229+ {std::make_shared<BufferReader>(buffer_right )}},
232230 sink, {{NULLPTR }, {NULLPTR }}, NULLPTR ,
233231 rewriter_properties);
234232 },
@@ -246,9 +244,10 @@ TEST(ParquetRewriterTest, InvalidInputDimensions) {
246244 ->build ();
247245
248246 auto schema = ::arrow::schema ({::arrow::field (" a" , ::arrow::int32 ())});
249- std::shared_ptr<Buffer> buffer;
250- WriteFile (rewriter_properties->writer_properties (),
251- ::arrow::TableFromJSON (schema, {R"( [[1]])" }), buffer);
247+
248+ ASSERT_OK_AND_ASSIGN (auto buffer,
249+ WriteFile (rewriter_properties->writer_properties (),
250+ ::arrow::TableFromJSON (schema, {R"( [[1]])" })));
252251
253252 auto sink = CreateOutputStream ();
254253
@@ -285,10 +284,10 @@ TEST(ParquetRewriterTest, AddCompression) {
285284 auto schema = ::arrow::schema (
286285 {::arrow::field (" a" , ::arrow::int32 ()), ::arrow::field (" b" , ::arrow::utf8 ())});
287286
288- std::shared_ptr<Buffer> buffer;
289- WriteFile (original_writer_props ,
290- ::arrow::TableFromJSON (schema, { R"( [[1, "a"], [2, "b"], [3, "c"]] )" }) ,
291- buffer );
287+ ASSERT_OK_AND_ASSIGN (
288+ auto buffer ,
289+ WriteFile (original_writer_props ,
290+ ::arrow::TableFromJSON (schema, { R"( [[1, "a"], [2, "b"], [3, "c"]] )" })) );
292291
293292 {
294293 auto file_reader = ParquetFileReader::Open (std::make_shared<BufferReader>(buffer));
@@ -344,10 +343,10 @@ TEST(ParquetRewriterTest, ChangeCompression) {
344343 auto schema = ::arrow::schema (
345344 {::arrow::field (" a" , ::arrow::int32 ()), ::arrow::field (" b" , ::arrow::utf8 ())});
346345
347- std::shared_ptr<Buffer> buffer;
348- WriteFile (original_writer_props ,
349- ::arrow::TableFromJSON (schema, { R"( [[1, "a"], [2, "b"], [3, "c"]] )" }) ,
350- buffer );
346+ ASSERT_OK_AND_ASSIGN (
347+ auto buffer ,
348+ WriteFile (original_writer_props ,
349+ ::arrow::TableFromJSON (schema, { R"( [[1, "a"], [2, "b"], [3, "c"]] )" })) );
351350
352351 {
353352 auto file_reader = ParquetFileReader::Open (std::make_shared<BufferReader>(buffer));
0 commit comments