HonahX commented on code in PR #305:
URL: https://github.com/apache/iceberg-python/pull/305#discussion_r1470492242
##########
tests/catalog/test_base.py:
##########
@@ -330,6 +334,34 @@ def test_create_table(catalog: InMemoryCatalog) -> None:
assert catalog.load_table(TEST_TABLE_IDENTIFIER) == table
[email protected](
+ "schema,expected",
+ [
+ (lazy_fixture("pyarrow_schema_simple_without_ids"),
lazy_fixture("iceberg_schema_simple_no_ids")),
+ (lazy_fixture("iceberg_schema_simple"),
lazy_fixture("iceberg_schema_simple")),
+ (lazy_fixture("iceberg_schema_nested"),
lazy_fixture("iceberg_schema_nested")),
+ (lazy_fixture("pyarrow_schema_nested_without_ids"),
lazy_fixture("iceberg_schema_nested_no_ids")),
+ ],
+)
+def test_convert_schema_if_needed(
+ schema: Union[Schema, pa.Schema],
+ expected: Schema,
+ catalog: InMemoryCatalog,
+) -> None:
+ assert expected == catalog._convert_schema_if_needed(schema)
+
+
+def test_create_table_pyarrow_schema(catalog: InMemoryCatalog,
pyarrow_schema_simple_without_ids: pa.Schema) -> None:
+ table = catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=pyarrow_schema_simple_without_ids,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ properties=TEST_TABLE_PROPERTIES,
+ )
+ assert catalog.load_table(TEST_TABLE_IDENTIFIER) == table
+
Review Comment:
Thanks for trying this!
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]