This is an automated email from the ASF dual-hosted git repository.
kevinjqliu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg.git
The following commit(s) were added to refs/heads/main by this push:
new 65cb42d6e6 Azure: Ignore null values for ADLS block size properties
(#18528)
65cb42d6e6 is described below
commit 65cb42d6e6d850f8ee961cec70d0bf414f692376
Author: raashed <[email protected]>
AuthorDate: Wed Oct 21 08:14:25 2026 +0530
Azure: Ignore null values for ADLS block size properties (#18528)
---
.../main/java/org/apache/iceberg/azure/AzureProperties.java | 9 +++------
.../java/org/apache/iceberg/azure/TestAzureProperties.java | 12 ++++++++++++
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/azure/src/main/java/org/apache/iceberg/azure/AzureProperties.java
b/azure/src/main/java/org/apache/iceberg/azure/AzureProperties.java
index 383bec3011..67bb72f02d 100644
--- a/azure/src/main/java/org/apache/iceberg/azure/AzureProperties.java
+++ b/azure/src/main/java/org/apache/iceberg/azure/AzureProperties.java
@@ -118,12 +118,9 @@ public class AzureProperties implements Serializable {
this.namedKeyCreds = Maps.immutableEntry(sharedKeyAccountName,
sharedKeyAccountKey);
}
- if (properties.containsKey(ADLS_READ_BLOCK_SIZE)) {
- this.adlsReadBlockSize =
Integer.parseInt(properties.get(ADLS_READ_BLOCK_SIZE));
- }
- if (properties.containsKey(ADLS_WRITE_BLOCK_SIZE)) {
- this.adlsWriteBlockSize =
Long.parseLong(properties.get(ADLS_WRITE_BLOCK_SIZE));
- }
+ this.adlsReadBlockSize = PropertyUtil.propertyAsNullableInt(properties,
ADLS_READ_BLOCK_SIZE);
+ this.adlsWriteBlockSize =
+ PropertyUtil.propertyAsNullableLong(properties, ADLS_WRITE_BLOCK_SIZE);
this.adlsRefreshCredentialsEndpoint =
RESTUtil.resolveEndpoint(
properties.get(CatalogProperties.URI),
diff --git
a/azure/src/test/java/org/apache/iceberg/azure/TestAzureProperties.java
b/azure/src/test/java/org/apache/iceberg/azure/TestAzureProperties.java
index c301d4de47..6f334a7dcc 100644
--- a/azure/src/test/java/org/apache/iceberg/azure/TestAzureProperties.java
+++ b/azure/src/test/java/org/apache/iceberg/azure/TestAzureProperties.java
@@ -53,6 +53,7 @@ import org.apache.iceberg.CatalogProperties;
import org.apache.iceberg.TestHelpers;
import org.apache.iceberg.azure.adlsv2.VendedAdlsCredentialProvider;
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
+import org.apache.iceberg.relocated.com.google.common.collect.Maps;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
@@ -298,6 +299,17 @@ public class TestAzureProperties {
verify(clientBuilder,
never()).credential(any(StorageSharedKeyCredential.class));
}
+ @Test
+ public void nullValuesAreIgnored() {
+ Map<String, String> properties = Maps.newHashMap();
+ properties.put(ADLS_READ_BLOCK_SIZE, null);
+ properties.put(ADLS_WRITE_BLOCK_SIZE, null);
+
+ AzureProperties azureProperties = new AzureProperties(properties);
+ assertThat(azureProperties.adlsReadBlockSize()).isEmpty();
+ assertThat(azureProperties.adlsWriteBlockSize()).isEmpty();
+ }
+
static class DummyTokenCredential implements TokenCredential {
@Override
public Mono<AccessToken> getToken(TokenRequestContext request) {