anjakefala commented on code in PR #35860:
URL: https://github.com/apache/arrow/pull/35860#discussion_r1213642872


##########
python/pyarrow/tests/test_dataset.py:
##########
@@ -5192,13 +5188,45 @@ def test_preserve_nullability_parquet(tempdir):
     # nullability of field is preserved
     assert dataset.to_table().schema.equals(schema_nullable)
 
-    table_no_null = pa.Table.from_arrays(array, schema=schema)
-
-    # we can specify the nullability of a field through the schema
-    pa.dataset.write_dataset(table_no_null, tempdir/"nulltest2", 
schema=schema_nullable)
+    pa.dataset.write_dataset(table, tempdir/"nulltest2", format="parquet")
     dataset = ds.dataset(tempdir/"nulltest2", format="parquet")
     assert dataset.to_table().schema.equals(schema_nullable)
 
+    pa.dataset.write_dataset([table, table], tempdir/"nulltest3", 
format="parquet")
+    dataset = ds.dataset(tempdir/"nulltest3", format="parquet")
+    assert dataset.to_table().schema.equals(schema_nullable)
+
+
+def test_preserve_field_metadata(tempdir):
+    schema_metadata = pa.schema([
+        pa.field("x", pa.int64(), metadata={b'foo': b'bar'}),
+        pa.field("y", pa.int64())])
+
+    schema_no_meta = pa.schema([
+        pa.field("x", pa.int64()),
+        pa.field("y", pa.int64())])
+
+    array = [[1, 2, 3], [None, 5, None]]
+    table = pa.Table.from_arrays(array, schema=schema_metadata)
+    table_no_meta = pa.Table.from_arrays(array, schema=schema_no_meta)
+
+    # If no schema is provided the schema of the first table will be used
+    pa.dataset.write_dataset([table, table_no_meta],

Review Comment:
   ```
   ds.write_dataset([table, table_no_meta],
   ```



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