Fokko commented on code in PR #4626:
URL: https://github.com/apache/iceberg-python/pull/4626#discussion_r4812278548


##########
pyiceberg/io/fsspec.py:
##########
@@ -265,13 +266,21 @@ def _gs(properties: Properties) -> AbstractFileSystem:
     if token and (expires_at := properties.get(GCS_TOKEN_EXPIRES_AT_MS)):
         token = Credentials(token, expiry=millis_to_datetime(int(expires_at)))
 
+    requester_pays: bool | str
+    if GCS_REQUESTER_PAYS in properties:
+        requester_pays = property_as_bool(properties, GCS_REQUESTER_PAYS, 
False)

Review Comment:
   Nit: `property_as_bool` treats an explicit empty string as unset (`value not 
in (None, "")`), so with `gcs.requester-pays=""` we'd take this branch and 
ignore `gcs.user-project`. Could you match that here? Suggests itself as a 
small change:
   
   ```suggestion
       if (requester_pays_value := properties.get(GCS_REQUESTER_PAYS)) not in 
(None, ""):
           requester_pays = property_as_bool(properties, GCS_REQUESTER_PAYS, 
False)
       elif user_project := properties.get(GCS_USER_PROJECT):
           requester_pays = user_project
       else:
           requester_pays = False
   ```
   
   Might also be worth a test case for `gcs.requester-pays=""` next to 
`gcs.user-project`.



##########
mkdocs/docs/configuration.md:
##########
@@ -242,6 +242,7 @@ export AWS_RESPONSE_CHECKSUM_VALIDATION=when_required
 | gcs.consistency             | md5                 | Configure the check 
method when writing files. Must be one of 'none', 'size', or 'md5'              
                                                                                
                                                                |
 | gcs.cache-timeout           | 60                  | Configure the cache 
expiration time in seconds for object metadata cache                            
                                                                                
                                                                |
 | gcs.requester-pays          | False               | Configure whether to use 
requester-pays requests                                                         
                                                                                
                                                           |
+| gcs.user-project            | my-billing-project  | Configure the user 
project billed for requester-pays requests (Java Iceberg fallback when 
`gcs.requester-pays` is not set).                                               
                                                                          |

Review Comment:
   Nit: in Java (`GCSInputStream`/`GCSOutputStream`) `gcs.user-project` is 
applied whenever it's set, not only as a fallback, so the doc row reads 
slightly stricter than the code below it (an explicit 
`gcs.requester-pays=false` also skips it here). Happy either way, just flagging 
the wording:
   
   ```suggestion
   | gcs.user-project            | my-billing-project  | Configure the user 
project billed for requester-pays requests, used when `gcs.requester-pays` is 
not set explicitly.                                                             
                                                                   |
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to