waterWang opened a new pull request, #17784:
URL: https://github.com/apache/iceberg/pull/17784

   ### Problem
   
   `GCPProperties` and `AzureProperties` throw `NumberFormatException` when 
optional numeric properties exist in the properties map with `null` values.
   
   `properties.containsKey(...)` returns `true` for null-valued entries, but 
`Integer.parseInt(null)` / `Long.parseLong(null)` raises 
`NumberFormatException: Cannot parse null string`.
   
   ### Changes
   
   - **GCPProperties.java**: Replaced `Integer.parseInt(properties.get(...))` 
with `PropertyUtil.propertyAsNullableInt` for `GCS_CHANNEL_READ_CHUNK_SIZE` and 
`GCS_CHANNEL_WRITE_CHUNK_SIZE`. Replaced `Long.parseLong(properties.get(...))` 
with `PropertyUtil.propertyAsNullableLong` for `GCS_OAUTH2_TOKEN_EXPIRES_AT`, 
with a null guard before the `new Date(...)` call.
   
   - **AzureProperties.java**: Replaced `Integer.parseInt(properties.get(...))` 
with `PropertyUtil.propertyAsNullableInt` for `ADLS_READ_BLOCK_SIZE`. Replaced 
`Long.parseLong(properties.get(...))` with 
`PropertyUtil.propertyAsNullableLong` for `ADLS_WRITE_BLOCK_SIZE`.
   
   - **TestGCPProperties.java**: Added `testNullNumericPropertiesAreIgnored` to 
verify null values are treated as absent.
   
   - **TestAzureProperties.java**: Added `testNullBlockSizesAreIgnored` to 
verify null values are treated as absent.
   
   Fixes #17771


-- 
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