From be3eb1ca2a44f861aed3e9593e7a73523a481092 Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Mon, 29 Jan 2024 19:24:34 -0800 Subject: [PATCH] rebase from main --- pyiceberg/catalog/in_memory.py | 6 +++++- tests/catalog/test_base.py | 5 ++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pyiceberg/catalog/in_memory.py b/pyiceberg/catalog/in_memory.py index a9e42e428a..a32dad3996 100644 --- a/pyiceberg/catalog/in_memory.py +++ b/pyiceberg/catalog/in_memory.py @@ -7,6 +7,8 @@ Union, ) +import pyarrow as pa + from pyiceberg.catalog import ( Catalog, Identifier, @@ -51,13 +53,15 @@ def __init__(self, name: str, **properties: str) -> None: def create_table( self, identifier: Union[str, Identifier], - schema: Schema, + schema: Union[Schema, "pa.Schema"], location: Optional[str] = None, partition_spec: PartitionSpec = UNPARTITIONED_PARTITION_SPEC, sort_order: SortOrder = UNSORTED_SORT_ORDER, properties: Properties = EMPTY_DICT, table_uuid: Optional[uuid.UUID] = None, ) -> Table: + schema: Schema = self._convert_schema_if_needed(schema) # type: ignore + identifier = Catalog.identifier_to_tuple(identifier) namespace = Catalog.namespace_from(identifier) diff --git a/tests/catalog/test_base.py b/tests/catalog/test_base.py index f993b40e01..572c38d348 100644 --- a/tests/catalog/test_base.py +++ b/tests/catalog/test_base.py @@ -17,9 +17,10 @@ # pylint:disable=redefined-outer-name -import pyarrow as pa from pathlib import PosixPath +from typing import Union +import pyarrow as pa import pytest from pytest_lazyfixture import lazy_fixture @@ -160,8 +161,6 @@ def test_create_table_pyarrow_schema(catalog: InMemoryCatalog, pyarrow_schema_si 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