Skip to content

Commit 5b10f25

Browse files
committed
Merge branch 'main' of github.com:apache/iceberg-python into fd-add-ability-to-delete-full-data-files
2 parents ddf6119 + cf3bf8a commit 5b10f25

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1043
-1012
lines changed

pyiceberg/catalog/hive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def __init__(self, uri: str, ugi: Optional[str] = None):
146146
protocol = TBinaryProtocol.TBinaryProtocol(transport)
147147

148148
self._client = Client(protocol)
149-
self._ugi = ugi.split(':') if ugi else None
149+
self._ugi = ugi.split(":") if ugi else None
150150

151151
def __enter__(self) -> Client:
152152
self._transport.open()

pyiceberg/catalog/rest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class CreateTableRequest(IcebergBaseModel):
152152
properties: Dict[str, str] = Field(default_factory=dict)
153153

154154
# validators
155-
@field_validator('properties', mode='before')
155+
@field_validator("properties", mode="before")
156156
def transform_properties_dict_value_to_str(cls, properties: Properties) -> Dict[str, str]:
157157
return transform_dict_value_to_str(properties)
158158

pyiceberg/expressions/parser.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
identifier = Word(alphas, alphanums + "_$").set_results_name("identifier")
7979
column = DelimitedList(identifier, delim=".", combine=False).set_results_name("column")
8080

81-
like_regex = r'(?P<valid_wildcard>(?<!\\)%$)|(?P<invalid_wildcard>(?<!\\)%)'
81+
like_regex = r"(?P<valid_wildcard>(?<!\\)%$)|(?P<invalid_wildcard>(?<!\\)%)"
8282

8383

8484
@column.set_parse_action
@@ -232,12 +232,12 @@ def _evaluate_like_statement(result: ParseResults) -> BooleanExpression:
232232

233233
match = re.search(like_regex, literal_like.value)
234234

235-
if match and match.groupdict()['invalid_wildcard']:
235+
if match and match.groupdict()["invalid_wildcard"]:
236236
raise ValueError("LIKE expressions only supports wildcard, '%', at the end of a string")
237-
elif match and match.groupdict()['valid_wildcard']:
238-
return StartsWith(result.column, StringLiteral(literal_like.value[:-1].replace('\\%', '%')))
237+
elif match and match.groupdict()["valid_wildcard"]:
238+
return StartsWith(result.column, StringLiteral(literal_like.value[:-1].replace("\\%", "%")))
239239
else:
240-
return EqualTo(result.column, StringLiteral(literal_like.value.replace('\\%', '%')))
240+
return EqualTo(result.column, StringLiteral(literal_like.value.replace("\\%", "%")))
241241

242242

243243
predicate = (comparison | in_check | null_check | nan_check | starts_check | boolean).set_results_name("predicate")

pyiceberg/manifest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import math
2020
from abc import ABC, abstractmethod
21+
from copy import copy
2122
from enum import Enum
2223
from types import TracebackType
2324
from typing import (
@@ -909,7 +910,7 @@ def __init__(self, output_file: OutputFile, snapshot_id: int, parent_snapshot_id
909910
self._sequence_number = sequence_number
910911

911912
def prepare_manifest(self, manifest_file: ManifestFile) -> ManifestFile:
912-
wrapped_manifest_file = ManifestFile(*manifest_file.record_fields())
913+
wrapped_manifest_file = copy(manifest_file)
913914

914915
if wrapped_manifest_file.sequence_number == UNASSIGNED_SEQ:
915916
# if the sequence number is being assigned here, then the manifest must be created by the current operation.

pyiceberg/partitioning.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,11 @@ def partition_to_path(self, data: Record, schema: Schema) -> str:
229229

230230
field_strs = []
231231
value_strs = []
232-
for pos, value in enumerate(data.record_fields()):
232+
for pos in range(len(self.fields)):
233233
partition_field = self.fields[pos]
234-
value_str = partition_field.transform.to_human_string(field_types[pos].field_type, value=value)
234+
value_str = partition_field.transform.to_human_string(field_types[pos].field_type, value=data[pos])
235235

236-
value_str = quote(value_str, safe='')
236+
value_str = quote(value_str, safe="")
237237
value_strs.append(value_str)
238238
field_strs.append(partition_field.name)
239239

pyiceberg/schema.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,29 +1311,29 @@ def _valid_avro_name(name: str) -> bool:
13111311
length = len(name)
13121312
assert length > 0, ValueError("Can not validate empty avro name")
13131313
first = name[0]
1314-
if not (first.isalpha() or first == '_'):
1314+
if not (first.isalpha() or first == "_"):
13151315
return False
13161316

13171317
for character in name[1:]:
1318-
if not (character.isalnum() or character == '_'):
1318+
if not (character.isalnum() or character == "_"):
13191319
return False
13201320
return True
13211321

13221322

13231323
def _sanitize_name(name: str) -> str:
13241324
sb = []
13251325
first = name[0]
1326-
if not (first.isalpha() or first == '_'):
1326+
if not (first.isalpha() or first == "_"):
13271327
sb.append(_sanitize_char(first))
13281328
else:
13291329
sb.append(first)
13301330

13311331
for character in name[1:]:
1332-
if not (character.isalnum() or character == '_'):
1332+
if not (character.isalnum() or character == "_"):
13331333
sb.append(_sanitize_char(character))
13341334
else:
13351335
sb.append(character)
1336-
return ''.join(sb)
1336+
return "".join(sb)
13371337

13381338

13391339
def _sanitize_char(character: str) -> str:

0 commit comments

Comments
 (0)