Skip to content

Commit 651729e

Browse files
committed
accept dict with only 'type': 'null'
1 parent 483d947 commit 651729e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pyiceberg/utils/schema_conversion.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@ def _resolve_union(
171171
# This means that null has to come first:
172172
# https://avro.apache.org/docs/current/spec.html
173173
# type of the default value must match the first element of the union.
174-
if "null" != avro_types[0]:
175-
raise TypeError("Only null-unions are supported")
174+
if avro_types[0] != "null" and avro_types[0] != {'type': 'null'}:
175+
raise TypeError(f"Only null-unions are supported, not: {avro_types[0]}")
176176

177177
# Filter the null value and return the type
178-
return list(filter(lambda t: t != "null", avro_types))[0], False
178+
return list(filter(lambda t: t != "null" and t != {'type': 'null'}, avro_types))[0], False
179179

180180
def _convert_schema(self, avro_type: Union[str, Dict[str, Any]]) -> IcebergType:
181181
"""

0 commit comments

Comments
 (0)