This is an automated email from the ASF dual-hosted git repository.
kharekartik pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 24130673d8 Fix the NPE for ADLSGen2PinotFS (#9088)
24130673d8 is described below
commit 24130673d8f23f297de30fa1600f42954184ba62
Author: Seunghyun Lee <[email protected]>
AuthorDate: Fri Jul 22 08:18:29 2022 -0700
Fix the NPE for ADLSGen2PinotFS (#9088)
When the proxyPort is null, we have had the issue with NPE.
This PR fixes the issue.
---
.../pinot/plugin/filesystem/ADLSGen2PinotFS.java | 18 ++++++++----------
.../plugin/filesystem/test/ADLSGen2PinotFSTest.java | 2 +-
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git
a/pinot-plugins/pinot-file-system/pinot-adls/src/main/java/org/apache/pinot/plugin/filesystem/ADLSGen2PinotFS.java
b/pinot-plugins/pinot-file-system/pinot-adls/src/main/java/org/apache/pinot/plugin/filesystem/ADLSGen2PinotFS.java
index ff53cb35d5..3a3a684b21 100644
---
a/pinot-plugins/pinot-file-system/pinot-adls/src/main/java/org/apache/pinot/plugin/filesystem/ADLSGen2PinotFS.java
+++
b/pinot-plugins/pinot-file-system/pinot-adls/src/main/java/org/apache/pinot/plugin/filesystem/ADLSGen2PinotFS.java
@@ -75,10 +75,9 @@ public class ADLSGen2PinotFS extends BasePinotFS {
private static final Logger LOGGER =
LoggerFactory.getLogger(ADLSGen2PinotFS.class);
private enum AuthenticationType {
- ACCESS_KEY,
- AZURE_AD,
- AZURE_AD_WITH_PROXY
+ ACCESS_KEY, AZURE_AD, AZURE_AD_WITH_PROXY
}
+
private static final String AUTHENTICATION_TYPE = "authenticationType";
private static final String ACCOUNT_NAME = "accountName";
private static final String ACCESS_KEY = "accessKey";
@@ -139,7 +138,7 @@ public class ADLSGen2PinotFS extends BasePinotFS {
String proxyHost = config.getProperty(PROXY_HOST);
String proxyUsername = config.getProperty(PROXY_USERNAME);
String proxyPassword = config.getProperty(PROXY_PASSWORD);
- Integer proxyPort = Integer.parseInt(config.getProperty(PROXY_PORT));
+ String proxyPort = config.getProperty(PROXY_PORT);
String dfsServiceEndpointUrl = HTTPS_URL_PREFIX + accountName +
AZURE_STORAGE_DNS_SUFFIX;
String blobServiceEndpointUrl = HTTPS_URL_PREFIX + accountName +
AZURE_BLOB_DNS_SUFFIX;
@@ -183,9 +182,9 @@ public class ADLSGen2PinotFS extends BasePinotFS {
Preconditions.checkNotNull(proxyPassword, "Proxy Password cannot be
null");
NettyAsyncHttpClientBuilder builder = new
NettyAsyncHttpClientBuilder();
- builder.proxy(
- new ProxyOptions(ProxyOptions.Type.HTTP, new
InetSocketAddress(proxyHost, proxyPort)).setCredentials(
- proxyUsername, proxyPassword));
+ builder.proxy(new ProxyOptions(ProxyOptions.Type.HTTP,
+ new InetSocketAddress(proxyHost,
Integer.parseInt(proxyPort))).setCredentials(proxyUsername,
+ proxyPassword));
ClientSecretCredentialBuilder clientSecretCredentialBuilder =
new
ClientSecretCredentialBuilder().clientId(clientId).clientSecret(clientSecret).tenantId(tenantId);
clientSecretCredentialBuilder.httpClient(builder.build());
@@ -246,9 +245,8 @@ public class ADLSGen2PinotFS extends BasePinotFS {
// By default, create directory call will overwrite if the path already
exists. Setting IfNoneMatch = "*" to
// prevent overwrite.
https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create
DataLakeRequestConditions requestConditions = new
DataLakeRequestConditions().setIfNoneMatch("*");
- _fileSystemClient
-
.createDirectoryWithResponse(AzurePinotFSUtil.convertUriToUrlEncodedAzureStylePath(uri),
null, null, null,
- null, requestConditions, null, null);
+
_fileSystemClient.createDirectoryWithResponse(AzurePinotFSUtil.convertUriToUrlEncodedAzureStylePath(uri),
null,
+ null, null, null, requestConditions, null, null);
return true;
} catch (DataLakeStorageException e) {
// If the path already exists, doing nothing and return true
diff --git
a/pinot-plugins/pinot-file-system/pinot-adls/src/test/java/org/apache/pinot/plugin/filesystem/test/ADLSGen2PinotFSTest.java
b/pinot-plugins/pinot-file-system/pinot-adls/src/test/java/org/apache/pinot/plugin/filesystem/test/ADLSGen2PinotFSTest.java
index b56179637c..6a4ec9b9fd 100644
---
a/pinot-plugins/pinot-file-system/pinot-adls/src/test/java/org/apache/pinot/plugin/filesystem/test/ADLSGen2PinotFSTest.java
+++
b/pinot-plugins/pinot-file-system/pinot-adls/src/test/java/org/apache/pinot/plugin/filesystem/test/ADLSGen2PinotFSTest.java
@@ -102,7 +102,7 @@ public class ADLSGen2PinotFSTest {
_mockFileClient, _mockBlobContainerClient, _mockBlobClient,
_mockBlobServiceClient, _mockBlobInputStream);
}
- @Test(expectedExceptions = IllegalArgumentException.class)
+ @Test(expectedExceptions = NullPointerException.class)
public void testInitNoAuth() {
PinotConfiguration pinotConfiguration = new PinotConfiguration();
_adlsGen2PinotFsUnderTest.init(pinotConfiguration);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]