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

dongjoon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git


The following commit(s) were added to refs/heads/main by this push:
     new 020d58225 ORC-1932: Use `setIfUnset` for `fs.defaultFS` and 
`fs.file.impl.disable.cache`
020d58225 is described below

commit 020d58225dcf8998cec17540921f254919610293
Author: Dongjoon Hyun <[email protected]>
AuthorDate: Fri Jun 20 09:05:45 2025 -0700

    ORC-1932: Use `setIfUnset` for `fs.defaultFS` and 
`fs.file.impl.disable.cache`
    
    ### What changes were proposed in this pull request?
    
    This PR aims to use `setIfUnset` instead of `set` for `fs.defaultFS` and 
`fs.file.impl.disable.cache` in `TestConf` and `tools` module.
    
    ### Why are the changes needed?
    
    These are newly added to Apache ORC 2.2, and `setIfUnset` is better because 
it respects the existing setting.
    
    ### How was this patch tested?
    
    Pass the CIs (including Java 25-ea CI)
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #2292 from dongjoon-hyun/ORC-1932.
    
    Authored-by: Dongjoon Hyun <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 java/core/src/test/org/apache/orc/TestConf.java           | 8 ++++----
 java/tools/src/java/org/apache/orc/tools/ColumnSizes.java | 2 +-
 java/tools/src/java/org/apache/orc/tools/Driver.java      | 2 +-
 java/tools/src/java/org/apache/orc/tools/FileDump.java    | 2 +-
 java/tools/src/java/org/apache/orc/tools/RowCount.java    | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/java/core/src/test/org/apache/orc/TestConf.java 
b/java/core/src/test/org/apache/orc/TestConf.java
index 225c83c8b..aedbeb8d4 100644
--- a/java/core/src/test/org/apache/orc/TestConf.java
+++ b/java/core/src/test/org/apache/orc/TestConf.java
@@ -30,14 +30,14 @@ public interface TestConf {
   @BeforeEach
   default void clear() {
     conf.clear();
-    conf.set("fs.defaultFS", "file:///");
-    conf.set("fs.file.impl.disable.cache", "true");
+    conf.setIfUnset("fs.defaultFS", "file:///");
+    conf.setIfUnset("fs.file.impl.disable.cache", "true");
   }
 
   private static Configuration getNewConf() {
     Configuration conf = new Configuration();
-    conf.set("fs.defaultFS", "file:///");
-    conf.set("fs.file.impl.disable.cache", "true");
+    conf.setIfUnset("fs.defaultFS", "file:///");
+    conf.setIfUnset("fs.file.impl.disable.cache", "true");
     return conf;
   }
 }
diff --git a/java/tools/src/java/org/apache/orc/tools/ColumnSizes.java 
b/java/tools/src/java/org/apache/orc/tools/ColumnSizes.java
index be9066583..d6b2d7612 100644
--- a/java/tools/src/java/org/apache/orc/tools/ColumnSizes.java
+++ b/java/tools/src/java/org/apache/orc/tools/ColumnSizes.java
@@ -217,7 +217,7 @@ public class ColumnSizes {
 
   public static void main(String[] args) throws Exception {
     Configuration conf = new Configuration();
-    conf.set("fs.file.impl.disable.cache", "true");
+    conf.setIfUnset("fs.file.impl.disable.cache", "true");
     main(conf, args);
   }
 
diff --git a/java/tools/src/java/org/apache/orc/tools/Driver.java 
b/java/tools/src/java/org/apache/orc/tools/Driver.java
index c94e76f34..92320b92b 100644
--- a/java/tools/src/java/org/apache/orc/tools/Driver.java
+++ b/java/tools/src/java/org/apache/orc/tools/Driver.java
@@ -103,7 +103,7 @@ public class Driver {
       System.exit(1);
     }
     Configuration conf = new Configuration();
-    conf.set("fs.file.impl.disable.cache", "true");
+    conf.setIfUnset("fs.file.impl.disable.cache", "true");
     Properties confSettings = options.genericOptions.getOptionProperties("D");
     for(Map.Entry pair: confSettings.entrySet()) {
       conf.set(pair.getKey().toString(), pair.getValue().toString());
diff --git a/java/tools/src/java/org/apache/orc/tools/FileDump.java 
b/java/tools/src/java/org/apache/orc/tools/FileDump.java
index 27b0e4f8a..1554a2647 100644
--- a/java/tools/src/java/org/apache/orc/tools/FileDump.java
+++ b/java/tools/src/java/org/apache/orc/tools/FileDump.java
@@ -142,7 +142,7 @@ public final class FileDump {
 
   public static void main(String[] args) throws Exception {
     Configuration conf = new Configuration();
-    conf.set("fs.file.impl.disable.cache", "true");
+    conf.setIfUnset("fs.file.impl.disable.cache", "true");
     main(conf, args);
   }
 
diff --git a/java/tools/src/java/org/apache/orc/tools/RowCount.java 
b/java/tools/src/java/org/apache/orc/tools/RowCount.java
index 3567f5674..9613d839d 100644
--- a/java/tools/src/java/org/apache/orc/tools/RowCount.java
+++ b/java/tools/src/java/org/apache/orc/tools/RowCount.java
@@ -73,7 +73,7 @@ public class RowCount {
 
   public static void main(String[] args) throws Exception {
     Configuration conf = new Configuration();
-    conf.set("fs.file.impl.disable.cache", "true");
+    conf.setIfUnset("fs.file.impl.disable.cache", "true");
     main(conf, args);
   }
 

Reply via email to