lidavidm commented on a change in pull request #12560:
URL: https://github.com/apache/arrow/pull/12560#discussion_r838484606



##########
File path: python/pyarrow/tests/test_dataset.py
##########
@@ -422,6 +422,32 @@ def test_scanner(dataset, dataset_reader):
 
     assert table.num_rows == scanner.count_rows()
 
+    scanner = dataset_reader.scanner(dataset, columns=['__filename',
+                                                       '__fragment_index',
+                                                       '__batch_index',
+                                                       '__last_in_fragment'],
+                                     memory_pool=pa.default_memory_pool())
+    table = scanner.to_table()
+    expected_names = ['__filename', '__fragment_index',
+                      '__batch_index', '__last_in_fragment']
+    assert table.column_names == expected_names
+
+    table_list_sorted = table.sort_by('__fragment_index').to_pylist()

Review comment:
       it might be clearer to do something like 
   ```
   sorted_table = table.sort_by(...)
   assert sorted_table['__fragment_index'].to_pylist() == ([0] * 5 + [1] * 5)
   assert sorted_table['__batch_index'].to_pylist() == [0] * 10
   # ...
   ```




-- 
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]


Reply via email to