Skip to content

Commit 1c7e550

Browse files
committed
Fixed force_virtual_addressing problem
1 parent eb8756a commit 1c7e550

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

pyiceberg/io/pyarrow.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ def _initialize_oss_fs(self) -> FileSystem:
408408
"access_key": get_first_property_value(self.properties, S3_ACCESS_KEY_ID, AWS_ACCESS_KEY_ID),
409409
"secret_key": get_first_property_value(self.properties, S3_SECRET_ACCESS_KEY, AWS_SECRET_ACCESS_KEY),
410410
"session_token": get_first_property_value(self.properties, S3_SESSION_TOKEN, AWS_SESSION_TOKEN),
411-
"region": get_first_property_value(self.properties, S3_REGION, AWS_REGION),
411+
"force_virtual_addressing": property_as_bool(self.properties, S3_FORCE_VIRTUAL_ADDRESSING, True)
412412
}
413413

414414
if proxy_uri := self.properties.get(S3_PROXY_URI):
@@ -426,9 +426,6 @@ def _initialize_oss_fs(self) -> FileSystem:
426426
if session_name := get_first_property_value(self.properties, S3_ROLE_SESSION_NAME, AWS_ROLE_SESSION_NAME):
427427
client_kwargs["session_name"] = session_name
428428

429-
if force_virtual_addressing := self.properties.get(S3_FORCE_VIRTUAL_ADDRESSING):
430-
client_kwargs["force_virtual_addressing"] = property_as_bool(self.properties, force_virtual_addressing, False)
431-
432429
return S3FileSystem(**client_kwargs)
433430

434431
def _initialize_s3_fs(self, netloc: Optional[str]) -> FileSystem:
@@ -472,8 +469,8 @@ def _initialize_s3_fs(self, netloc: Optional[str]) -> FileSystem:
472469
if session_name := get_first_property_value(self.properties, S3_ROLE_SESSION_NAME, AWS_ROLE_SESSION_NAME):
473470
client_kwargs["session_name"] = session_name
474471

475-
if force_virtual_addressing := self.properties.get(S3_FORCE_VIRTUAL_ADDRESSING):
476-
client_kwargs["force_virtual_addressing"] = property_as_bool(self.properties, force_virtual_addressing, False)
472+
if self.properties.get(S3_FORCE_VIRTUAL_ADDRESSING) != None:
473+
client_kwargs["force_virtual_addressing"] = property_as_bool(self.properties, S3_FORCE_VIRTUAL_ADDRESSING, False)
477474

478475
return S3FileSystem(**client_kwargs)
479476

0 commit comments

Comments
 (0)