This is an automated email from the ASF dual-hosted git repository.

Jackie-Jiang 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 dce46cad7bf adding support for unauthenticated access from pinot to 
hadoop (#18508)
dce46cad7bf is described below

commit dce46cad7bf2f33d73eba8db6a82d539734d5518
Author: Priyanshu <[email protected]>
AuthorDate: Sat Aug 8 02:09:17 2026 +0530

    adding support for unauthenticated access from pinot to hadoop (#18508)
---
 .../apache/pinot/plugin/filesystem/HadoopPinotFS.java   | 17 ++++++++++++++++-
 .../pinot/plugin/filesystem/HadoopPinotFSTest.java      | 16 ++++++++++++++++
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git 
a/pinot-plugins/pinot-file-system/pinot-hdfs/src/main/java/org/apache/pinot/plugin/filesystem/HadoopPinotFS.java
 
b/pinot-plugins/pinot-file-system/pinot-hdfs/src/main/java/org/apache/pinot/plugin/filesystem/HadoopPinotFS.java
index c7bc42b8863..1f85624615f 100644
--- 
a/pinot-plugins/pinot-file-system/pinot-hdfs/src/main/java/org/apache/pinot/plugin/filesystem/HadoopPinotFS.java
+++ 
b/pinot-plugins/pinot-file-system/pinot-hdfs/src/main/java/org/apache/pinot/plugin/filesystem/HadoopPinotFS.java
@@ -50,6 +50,8 @@ public class HadoopPinotFS extends BasePinotFS {
   private static final String KEYTAB = "hadoop.kerberos.keytab";
   private static final String HADOOP_CONF_PATH = "hadoop.conf.path";
   private static final String WRITE_CHECKSUM = "hadoop.write.checksum";
+  private static final String GLOBAL_HADOOP_USER = "hadoop.user.name";
+  private static final String ALLOW_INSECURE = "hadoop.allow.insecure";
 
   private org.apache.hadoop.fs.FileSystem _hadoopFS = null;
   private org.apache.hadoop.conf.Configuration _hadoopConf;
@@ -61,7 +63,20 @@ public class HadoopPinotFS extends BasePinotFS {
   public void init(PinotConfiguration config) {
     try {
       _hadoopConf = getConf(config.getProperty(HADOOP_CONF_PATH));
-      authenticate(_hadoopConf, config);
+      boolean allowInsecure = 
Boolean.parseBoolean(config.getProperty(ALLOW_INSECURE, "false"));
+
+      if (!allowInsecure) {
+        authenticate(_hadoopConf, config);
+      } else {
+        String globalHadoopUser = config.getProperty(GLOBAL_HADOOP_USER);
+        if (Strings.isNullOrEmpty(globalHadoopUser)) {
+          throw new RuntimeException("HADOOP_USER must be provided when 
ALLOW_INSECURE is true");
+        }
+
+        UserGroupInformation ugi = 
UserGroupInformation.createRemoteUser(globalHadoopUser);
+        UserGroupInformation.setLoginUser(ugi);
+        LOGGER.info("Setting HDFS login user to: {}", globalHadoopUser);
+      }
       _hadoopFS = org.apache.hadoop.fs.FileSystem.get(_hadoopConf);
       _hadoopFS.setWriteChecksum((config.getProperty(WRITE_CHECKSUM, false)));
       LOGGER.info("successfully initialized HadoopPinotFS");
diff --git 
a/pinot-plugins/pinot-file-system/pinot-hdfs/src/test/java/org/apache/pinot/plugin/filesystem/HadoopPinotFSTest.java
 
b/pinot-plugins/pinot-file-system/pinot-hdfs/src/test/java/org/apache/pinot/plugin/filesystem/HadoopPinotFSTest.java
index b6638a1b991..7492e5a4412 100644
--- 
a/pinot-plugins/pinot-file-system/pinot-hdfs/src/test/java/org/apache/pinot/plugin/filesystem/HadoopPinotFSTest.java
+++ 
b/pinot-plugins/pinot-file-system/pinot-hdfs/src/test/java/org/apache/pinot/plugin/filesystem/HadoopPinotFSTest.java
@@ -463,4 +463,20 @@ public class HadoopPinotFSTest {
       hadoopFS.delete(baseURI, true);
     }
   }
+
+  @Test
+  public void testInitWithUnauthenticatedUser()
+      throws IOException {
+    String testUser = "pinot-test-user-" + System.currentTimeMillis();
+
+    PinotConfiguration config = new PinotConfiguration();
+    config.setProperty("hadoop.allow.insecure", "true");
+    config.setProperty("hadoop.user.name", testUser);
+
+    try (HadoopPinotFS hadoopFS = new HadoopPinotFS()) {
+      hadoopFS.init(config);
+      String currentUser = 
org.apache.hadoop.security.UserGroupInformation.getLoginUser().getUserName();
+      Assert.assertEquals(currentUser, testUser, "The Hadoop login user was 
not set correctly!");
+    }
+  }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to