Copilot commented on code in PR #54691:
URL: https://github.com/apache/arrow/pull/54691#discussion_r4376068854
##########
python/pyarrow/tests/test_dataset.py:
##########
@@ -3567,6 +3568,29 @@ def test_csv_format_options_generate_columns(tempdir,
dataset_reader):
'f3': pa.array([1])}))
+def test_csv_format_pad_short_rows(tempdir, dataset_reader):
+ path = str(tempdir / 'short.csv')
+ with open(path, 'w') as sink:
+ sink.write('a,b,c\n1,2,3\n4,5\n6\n')
+
+ # Default format fails on short rows
+ dataset_default = ds.dataset(path, format='csv')
+ with pytest.raises(pa.ArrowInvalid, match="Expected 3 columns, got 2:
4,5"):
+ dataset_reader.to_table(dataset_default)
Review Comment:
`ds.dataset()` parses the first CSV block to infer the schema, and this
entire input fits in that block. The short row therefore raises `ArrowInvalid`
before `pytest.raises` is entered, so both fixture variants fail before
reaching the padding assertions. Move dataset construction inside the exception
context.
--
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]