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 29c1b3795 ORC-1938: Update `tools` module to set 
`fs.file.impl.disable.cache` only for Java 22+
29c1b3795 is described below

commit 29c1b37955e3423681304c6e9eb3fe7884ba57bc
Author: Dongjoon Hyun <dongj...@apache.org>
AuthorDate: Mon Jun 23 16:09:21 2025 -0700

    ORC-1938: Update `tools` module to set `fs.file.impl.disable.cache` only 
for Java 22+
    
    ### What changes were proposed in this pull request?
    
    This PR aims to update `tools` module to set 
`fs.file.impl.disable.cache=true` only for Java 22+.
    
    ### Why are the changes needed?
    
    Recently, we successfully finished to refactor `tools` module for Java 
25-ea support. Before releasing Apache ORC 2.2, we want to minimize any 
potential side-effects by applying new changes to the Java 22+ versions.
    
    - ORC-1926: Use `TestConf` interface in `tools` module
    - ORC-1927: Add Java `25-ea` test coverage for `tools` module
    - ORC-1931: Suppress Hadoop logs lower than ERROR level in `orc-tools`
    - ORC-1932: Use `setIfUnset` for `fs.defaultFS` and 
`fs.file.impl.disable.cache`
    
    ### How was this patch tested?
    
    Pass the CIs (with Java 25-ea tool tests)
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #2297 from dongjoon-hyun/ORC-1938.
    
    Authored-by: Dongjoon Hyun <dongj...@apache.org>
    Signed-off-by: Dongjoon Hyun <dongj...@apache.org>
---
 java/tools/src/java/org/apache/orc/tools/ColumnSizes.java | 4 +++-
 java/tools/src/java/org/apache/orc/tools/Driver.java      | 4 +++-
 java/tools/src/java/org/apache/orc/tools/FileDump.java    | 4 +++-
 java/tools/src/java/org/apache/orc/tools/RowCount.java    | 4 +++-
 4 files changed, 12 insertions(+), 4 deletions(-)

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 d6b2d7612..c4d5c2973 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,9 @@ public class ColumnSizes {
 
   public static void main(String[] args) throws Exception {
     Configuration conf = new Configuration();
-    conf.setIfUnset("fs.file.impl.disable.cache", "true");
+    if (Runtime.version().feature() > 21) {
+      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 92320b92b..cdf594fe2 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,9 @@ public class Driver {
       System.exit(1);
     }
     Configuration conf = new Configuration();
-    conf.setIfUnset("fs.file.impl.disable.cache", "true");
+    if (Runtime.version().feature() > 21) {
+      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 1554a2647..7e952effb 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,9 @@ public final class FileDump {
 
   public static void main(String[] args) throws Exception {
     Configuration conf = new Configuration();
-    conf.setIfUnset("fs.file.impl.disable.cache", "true");
+    if (Runtime.version().feature() > 21) {
+      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 9613d839d..779b90b85 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,9 @@ public class RowCount {
 
   public static void main(String[] args) throws Exception {
     Configuration conf = new Configuration();
-    conf.setIfUnset("fs.file.impl.disable.cache", "true");
+    if (Runtime.version().feature() > 21) {
+      conf.setIfUnset("fs.file.impl.disable.cache", "true");
+    }
     main(conf, args);
   }
 

Reply via email to