Copilot commented on code in PR #50945:
URL: https://github.com/apache/arrow/pull/50945#discussion_r3906947064
##########
cpp/src/arrow/json/reader_test.cc:
##########
@@ -758,20 +757,23 @@ TEST_P(StreamingReaderTest,
PropagateErrorsNonLinewiseChunker) {
AssertReadNext(reader, &batch);
EXPECT_EQ(reader->bytes_processed(), 9);
ASSERT_BATCHES_EQUAL(*RecordBatchFromJSON(test_schema, "[{\"i\":0}]"),
*batch);
- // Chunker doesn't require newline delimiters, so this should be valid
+
+ // The chunker doesn't require newline delimiters between records.
AssertReadNext(reader, &batch);
EXPECT_EQ(reader->bytes_processed(), 20);
ASSERT_BATCHES_EQUAL(*RecordBatchFromJSON(test_schema, "[{\"i\":1}]"),
*batch);
+
+ // Depending on readahead, the malformed record may be reported by either
+ // the parser or the chunker on the next read.
+ auto status = reader->ReadNext(&batch);
+ if (status.ok()) {
+ status = reader->ReadNext(&batch);
+ }
+ ASSERT_FALSE(status.ok());
+ EXPECT_TRUE(status.IsInvalid());
Review Comment:
This test now only checks `status.IsInvalid()` for the malformed record
path. Since the code explicitly allows the error to come either from the parser
or the chunker, it would be good to still assert that the message matches one
of the expected error families (parse error vs chunker error) so unrelated
Invalid statuses don’t satisfy the test.
--
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]