Skip to content

Commit c97f724

Browse files
author
Abanoub Doss
committed
style: fix linting issues (line length and whitespace)
1 parent 336dcf8 commit c97f724

2 files changed

Lines changed: 24 additions & 7 deletions

File tree

pyiceberg/table/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ def upsert(
796796

797797
for col in join_cols:
798798
table_field = table_arrow_schema.field(col)
799-
# Table-level rejections: These types are fundamentally unreliable or
799+
# Table-level rejections: These types are fundamentally unreliable or
800800
# unsupported as join keys regardless of the input data format.
801801
if pa.types.is_floating(table_field.type):
802802
raise ValueError(
@@ -809,7 +809,7 @@ def upsert(
809809
"Only primitive types are supported."
810810
)
811811

812-
# Dataframe-level rejections: These implementation-specific formats (e.g.,
812+
# Dataframe-level rejections: These implementation-specific formats (e.g.,
813813
# dictionary encoding) are not yet supported by the PyArrow join engine.
814814
arr = df.column(col)
815815
if pa.types.is_dictionary(arr.type):

tests/table/test_upsert.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,11 @@ def test_upsert_with_struct_field_as_join_key(catalog: Catalog) -> None:
666666
)
667667

668668
with pytest.raises(
669-
ValueError, match="Nested column 'nested_type' of type 'struct<sub1: large_string not null, sub2: large_string not null>' cannot be used as a join key in upsert"
669+
ValueError,
670+
match=(
671+
"Nested column 'nested_type' of type 'struct<sub1: large_string not null, sub2: large_string not null>' "
672+
"cannot be used as a join key in upsert"
673+
),
670674
):
671675
_ = tbl.upsert(update_data, join_cols=["nested_type"])
672676

@@ -889,14 +893,27 @@ def test_upsert_snapshot_properties(catalog: Catalog) -> None:
889893
assert snapshot.summary is not None
890894
assert snapshot.summary.additional_properties.get("test_prop") == "test_value"
891895

896+
892897
@pytest.mark.parametrize(
893898
"arrow_type, expected_error, match",
894899
[
895900
(pa.float32(), ValueError, "Floating point column 'k' cannot be used as a join key in upsert"),
896901
(pa.float64(), ValueError, "Floating point column 'k' cannot be used as a join key in upsert"),
897-
(pa.struct([("a", pa.int32())]), ValueError, "Nested column 'k' of type 'struct<a: int32>' cannot be used as a join key in upsert"),
898-
(pa.list_(pa.int32()), ValueError, "Nested column 'k' of type 'list<item: int32>' cannot be used as a join key in upsert"),
899-
(pa.dictionary(pa.int32(), pa.string()), NotImplementedError, "Dictionary-encoded column 'k' is not currently supported as a join key in upsert"),
902+
(
903+
pa.struct([("a", pa.int32())]),
904+
ValueError,
905+
"Nested column 'k' of type 'struct<a: int32>' cannot be used as a join key in upsert",
906+
),
907+
(
908+
pa.list_(pa.int32()),
909+
ValueError,
910+
"Nested column 'k' of type 'list<item: int32>' cannot be used as a join key in upsert",
911+
),
912+
(
913+
pa.dictionary(pa.int32(), pa.string()),
914+
NotImplementedError,
915+
"Dictionary-encoded column 'k' is not currently supported as a join key in upsert",
916+
),
900917
(pa.null(), ValueError, "Null-type column 'k' cannot be used as a join key in upsert"),
901918
(pa.uuid(), NotImplementedError, "is not currently supported as a join key in upsert"),
902919
],
@@ -911,7 +928,7 @@ def test_upsert_unsupported_join_column_types(
911928
catalog.drop_table(identifier)
912929
except NoSuchTableError:
913930
pass
914-
931+
915932
# Define the table schema to be compatible with the arrow_type but still trigger our check
916933
if pa.types.is_dictionary(arrow_type):
917934
table_type = pa.string()

0 commit comments

Comments
 (0)