pitrou commented on code in PR #46961:
URL: https://github.com/apache/arrow/pull/46961#discussion_r2194852120


##########
python/pyarrow/tests/test_dataset.py:
##########
@@ -451,6 +487,67 @@ def test_dataset(dataset, dataset_reader):
     assert_dataset_fragment_convenience_methods(dataset)
 
 
+def test_dataset_factory_inspect_schema_promotion(promotable_mockfs):
+    mockfs, path1, path2 = promotable_mockfs
+    factory = ds.FileSystemDatasetFactory(
+        mockfs, [path1, path2], ds.ParquetFileFormat()
+    )
+
+    with pytest.raises(
+        pa.ArrowTypeError,
+        match='Unable to merge: Field value has incompatible types: int8 vs 
uint16',
+    ):
+        factory.inspect()
+
+    schema = factory.inspect(promote_options='permissive')
+    expected_schema = pa.schema([
+        pa.field('value', pa.int32()),
+        pa.field('dictionary', pa.dictionary(pa.int16(), pa.string())),

Review Comment:
   Perhaps add comments here to explain the promotions that are expected to 
occur? For example:
   ```suggestion
           # Promoted from int8 and uint16
           pa.field('value', pa.int32()),
           # Dictionary index type promoted from int8 and int16
           pa.field('dictionary', pa.dictionary(pa.int16(), pa.string())),
   ```



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to