fx19880617 commented on a change in pull request #6809:
URL: https://github.com/apache/incubator-pinot/pull/6809#discussion_r616216215



##########
File path: 
pinot-plugins/pinot-file-system/pinot-gcs/src/main/java/org/apache/pinot/plugin/filesystem/GcsPinotFS.java
##########
@@ -63,20 +63,21 @@
 
   @Override
   public void init(PinotConfiguration config) {
-    LOGGER.info("Configs are: {}, {}",
-            PROJECT_ID,
-            config.getProperty(PROJECT_ID));
+    Credentials credentials;
 
-    checkArgument(!isNullOrEmpty(config.getProperty(PROJECT_ID)));
-    checkArgument(!isNullOrEmpty(config.getProperty(GCP_KEY)));
-    String projectId = config.getProperty(PROJECT_ID);
-    String gcpKey = config.getProperty(GCP_KEY);
     try {
-      storage = StorageOptions.newBuilder()
-          .setProjectId(projectId)
-          
.setCredentials(GoogleCredentials.fromStream(Files.newInputStream(Paths.get(gcpKey))))
-          .build()
-          .getService();
+      StorageOptions.Builder storageBuilder = StorageOptions.newBuilder();
+      if (!isNullOrEmpty(config.getProperty(PROJECT_ID)) && 
!isNullOrEmpty(config.getProperty(GCP_KEY))) {
+        LOGGER.info("Configs are: {}, {}", PROJECT_ID, 
config.getProperty(PROJECT_ID));
+        String projectId = config.getProperty(PROJECT_ID);
+        String gcpKey = config.getProperty(GCP_KEY);
+        storageBuilder.setProjectId(projectId);

Review comment:
       Also, shall we check the presence of `PROJECT_ID` always? Or it's part 
from the application default?

##########
File path: 
pinot-plugins/pinot-file-system/pinot-gcs/src/main/java/org/apache/pinot/plugin/filesystem/GcsPinotFS.java
##########
@@ -63,20 +63,21 @@
 
   @Override
   public void init(PinotConfiguration config) {
-    LOGGER.info("Configs are: {}, {}",
-            PROJECT_ID,
-            config.getProperty(PROJECT_ID));
+    Credentials credentials;
 
-    checkArgument(!isNullOrEmpty(config.getProperty(PROJECT_ID)));
-    checkArgument(!isNullOrEmpty(config.getProperty(GCP_KEY)));
-    String projectId = config.getProperty(PROJECT_ID);
-    String gcpKey = config.getProperty(GCP_KEY);
     try {
-      storage = StorageOptions.newBuilder()
-          .setProjectId(projectId)
-          
.setCredentials(GoogleCredentials.fromStream(Files.newInputStream(Paths.get(gcpKey))))
-          .build()
-          .getService();
+      StorageOptions.Builder storageBuilder = StorageOptions.newBuilder();
+      if (!isNullOrEmpty(config.getProperty(PROJECT_ID)) && 
!isNullOrEmpty(config.getProperty(GCP_KEY))) {
+        LOGGER.info("Configs are: {}, {}", PROJECT_ID, 
config.getProperty(PROJECT_ID));
+        String projectId = config.getProperty(PROJECT_ID);
+        String gcpKey = config.getProperty(GCP_KEY);
+        storageBuilder.setProjectId(projectId);

Review comment:
       Also, shall we check the presence of `PROJECT_ID` always? Or it's part 
of the application default?




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

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