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


##########
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())),
+    ])
+    assert schema.equals(expected_schema)
+    dataset = factory.finish(schema)
+    table = dataset.to_table()

Review Comment:
   Let's validate the table contents for correctness.
   ```suggestion
       table = dataset.to_table()
       table.validate(full=True)
   ```



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