@@ -66,7 +66,7 @@ public class Util {
66
66
private static final long DEFAULT_EXEC_CMD_TIMEOUT_MS = 600000L ;
67
67
68
68
private static final String [] ORDINAL_SUFFIX
69
- = new String [] { "th" , "st" , "nd" , "rd" , "th" , "th" , "th" , "th" , "th" , "th" };
69
+ = new String [] {"th" , "st" , "nd" , "rd" , "th" , "th" , "th" , "th" , "th" , "th" };
70
70
71
71
private static final List <String > REGEX_ESCAPES
72
72
= Lists .newArrayList ("\\ " , "$" , "(" , ")" , "*" , "+" , "." , "[" , "]" , "?" , "^" , "{" , "}" , "|" );
@@ -389,7 +389,7 @@ public static long getLongPropertyOrDefault(String valStr, long defaultVal, Pred
389
389
}
390
390
391
391
public static double getDoublePropertyOrDefault (String valStr , double defaultVal , Predicate <Double > pred ,
392
- String hintMsg ) throws AnalysisException {
392
+ String hintMsg ) throws AnalysisException {
393
393
if (Strings .isNullOrEmpty (valStr )) {
394
394
return defaultVal ;
395
395
}
@@ -498,8 +498,8 @@ public static InputStream getInputStreamFromUrl(String urlStr, String encodedAut
498
498
499
499
public static boolean showHiddenColumns () {
500
500
return ConnectContext .get () != null && (
501
- ConnectContext .get ().getSessionVariable ().showHiddenColumns ()
502
- || ConnectContext .get ().getSessionVariable ().skipStorageEngineMerge ());
501
+ ConnectContext .get ().getSessionVariable ().showHiddenColumns ()
502
+ || ConnectContext .get ().getSessionVariable ().skipStorageEngineMerge ());
503
503
}
504
504
505
505
public static String escapeSingleRegex (String s ) {
@@ -700,7 +700,12 @@ public static long sha256long(String str) {
700
700
MessageDigest digest = MessageDigest .getInstance ("SHA-256" );
701
701
byte [] hash = digest .digest (str .getBytes (StandardCharsets .UTF_8 ));
702
702
ByteBuffer buffer = ByteBuffer .wrap (hash );
703
- return buffer .getLong ();
703
+ long result = buffer .getLong ();
704
+ // Handle Long.MIN_VALUE case to ensure non-negative ID generation
705
+ if (result == Long .MIN_VALUE ) {
706
+ return str .hashCode ();
707
+ }
708
+ return result ;
704
709
} catch (NoSuchAlgorithmException e ) {
705
710
return str .hashCode ();
706
711
}
0 commit comments