tomron opened a new pull request, #4532: URL: https://github.com/apache/iceberg-python/pull/4532
Closes #4529. Follow-up to #4489. Aligns `pyiceberg/utils/properties.py` with Java's `PropertyUtil`: - Only `None` is treated as unset. An empty string now raises `ValueError` in `property_as_int` / `property_as_float` (Java throws `NumberFormatException`). - `property_as_int` / `property_as_float` parse `str(value)`, so non-string values like `False` or `1.5` for an int property raise instead of becoming `0` / `1`. - `property_as_bool` matches `Boolean.parseBoolean`: only `"true"` (case-insensitive) is `True`; anything else, including `""`, is `False`. A `DeprecationWarning` is emitted for one release when the previous `strtobool` parsing would have returned `True` (`"1"`, `"yes"`, `"on"`, `"y"`, `"t"`). - `catalog/sql.py` (`echo`, `pool_pre_ping`, `init_catalog_tables`) and `s3.anonymous` in `io/pyarrow.py` / `io/fsspec.py` now use `property_as_bool`. - `get_first_property_value` only skips `None`. Callers that pass credentials, region or profile to the AWS SDKs (pyarrow, fsspec, Glue, DynamoDB, REST SigV4) map an empty value to `None`, so an empty credential still falls back to the default credential chain, as Java does with `Strings.isNullOrEmpty`. - All helpers take `Properties`. - Fixed the `*_with_invalid_value` tests, whose assertions were inside the `pytest.raises` block and never ran. ## User-facing changes (release notes) - An empty string property value no longer means "unset". Numeric properties set to `""` now raise, and boolean properties set to `""` are `False`. - Boolean properties follow Java's parsing: only `"true"` is true. `"1"`, `"yes"`, `"on"`, `"y"` and `"t"` are now `False` and emit a `DeprecationWarning`. - An empty value for a key such as `s3.access-key-id` no longer falls back to the next key (e.g. `client.access-key-id`); the default credential chain is used instead. -- 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]
