Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes, #523 followup #563

Merged
merged 4 commits into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pyiceberg/table/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1131,8 +1131,9 @@ def append(self, df: pa.Table, snapshot_properties: Dict[str, str] = EMPTY_DICT)

_check_schema_compatible(self.schema(), other_schema=df.schema)
# cast if the two schemas are compatible but not equal
if self.schema().as_arrow() != df.schema:
df = df.cast(self.schema().as_arrow())
table_arrow_schema = self.schema().as_arrow()
if table_arrow_schema != df.schema:
df = df.cast(table_arrow_schema)

with self.transaction() as txn:
with txn.update_snapshot(snapshot_properties=snapshot_properties).fast_append() as update_snapshot:
Expand Down
5 changes: 1 addition & 4 deletions tests/catalog/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def test_create_table_with_pyarrow_schema(
'catalog',
[
lazy_fixture('catalog_memory'),
# lazy_fixture('catalog_sqlite'),
lazy_fixture('catalog_sqlite'),
],
)
def test_write_pyarrow_schema(catalog: SqlCatalog, random_identifier: Identifier) -> None:
Expand All @@ -220,9 +220,6 @@ def test_write_pyarrow_schema(catalog: SqlCatalog, random_identifier: Identifier
database_name, _table_name = random_identifier
catalog.create_namespace(database_name)
table = catalog.create_table(random_identifier, pyarrow_table.schema)
print(pyarrow_table.schema)
print(table.schema().as_struct())
print()
table.overwrite(pyarrow_table)


Expand Down
1 change: 0 additions & 1 deletion tests/integration/test_reads.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ def test_ray_nan_rewritten(catalog: Catalog) -> None:
def test_ray_not_nan_count(catalog: Catalog) -> None:
table_test_null_nan_rewritten = catalog.load_table("default.test_null_nan_rewritten")
ray_dataset = table_test_null_nan_rewritten.scan(row_filter=NotNaN("col_numeric"), selected_fields=("idx",)).to_ray()
print(ray_dataset.take())
assert ray_dataset.count() == 2


Expand Down
1 change: 0 additions & 1 deletion tests/integration/test_writes.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,6 @@ def test_write_parquet_other_properties(
properties: Dict[str, Any],
expected_kwargs: Dict[str, Any],
) -> None:
print(type(mocker))
identifier = "default.test_write_parquet_other_properties"

# The properties we test cannot be checked on the resulting Parquet file, so we spy on the ParquetWriter call instead
Expand Down