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

joemcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit e5afebc0c1ed23bc3a040f70a2168120c052f8bd
Author: Michael Smith <[email protected]>
AuthorDate: Mon Sep 22 14:47:56 2025 -0700

    IMPALA-14450: (Addendum) Fix other numeric comparison
    
    Fixes
    
        set-impala-java-tool-options.sh: line 25: ((: 1.8: syntax error:
        invalid arithmetic operator (error token is ".8")
    
    Double parentheses - ((...)) - only support integer arithmetic. I can't
    find any standard way to do decimal comparison in shells, so switch to
    extract Java major version as an integer and compare that.
    
    OpenJDK 8 has always considered "-target 1.8" and "-target 8" equivalent
    
https://github.com/openjdk/jdk/blob/jdk8-b01/langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java#L105
    so maven target can be set to 8 when IMPALA_JAVA_TARGET is 8.
    
    Change-Id: I15cdd1859be51d3708f1c348e898831df2a92b13
    Reviewed-on: http://gerrit.cloudera.org:8080/23452
    Reviewed-by: Riza Suminto <[email protected]>
    Tested-by: Impala Public Jenkins <[email protected]>
---
 bin/impala-config.sh | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/bin/impala-config.sh b/bin/impala-config.sh
index 33da84f76..61b56fe2e 100755
--- a/bin/impala-config.sh
+++ b/bin/impala-config.sh
@@ -566,8 +566,8 @@ fi
 # Target the Java version matching the JDK.
 export IMPALA_JAVA_TARGET=$("$JAVA" -version 2>&1 | awk -F'[\".]' '/version/ 
{print $2}')
 if [[ $IMPALA_JAVA_TARGET -eq 1 ]]; then
-  # Capture 1.x.
-  IMPALA_JAVA_TARGET=$("$JAVA" -version 2>&1 | awk -F'[\".]' '/version/ {print 
$2"."$3}')
+  # Capture x from 1.x, i.e. Java 1.8 -> 8.
+  IMPALA_JAVA_TARGET=$("$JAVA" -version 2>&1 | awk -F'[\".]' '/version/ {print 
$3}')
 fi
 
 # Java libraries required by executables and java tests.
@@ -1279,13 +1279,12 @@ else
 fi
 
 # Check for minimum required Java version
-# Only issue Java version warning when running Java 7.
-if [[ $IMPALA_JAVA_TARGET == 1.7 ]]; then
+if [[ $IMPALA_JAVA_TARGET -le 7 ]]; then
   cat << EOF
 
-WARNING: Your development environment is configured for Hadoop 3 and Java 7. 
Hadoop 3
-requires at least Java 8. Your JAVA binary currently points to $JAVA
-and reports the following version:
+WARNING: Your development environment is configured for Hadoop 3 and Java
+$IMPALA_JAVA_TARGET. Hadoop 3 requires at least Java 8. Your JAVA binary
+currently points to $JAVA and reports the following version:
 
 EOF
   $JAVA -version

Reply via email to