Unverified Commit c9c03617 authored by gaoyan's avatar gaoyan Committed by GitHub

Replace int type with long type in the table process (#1834)

* Replace int type with long type in the table process * fix code formate
parent e5bdefe6
...@@ -44,8 +44,8 @@ public class SplitUtil { ...@@ -44,8 +44,8 @@ public class SplitUtil {
Pattern pattern = Pattern.compile(matchNumberRegex); Pattern pattern = Pattern.compile(matchNumberRegex);
Matcher matcher = pattern.matcher(value); Matcher matcher = pattern.matcher(value);
if (matcher.find()) { if (matcher.find()) {
int splitNum = Integer.parseInt(matcher.group(0).replaceFirst("_", "")); long splitNum = Long.parseLong(matcher.group(0).replaceFirst("_", ""));
int maxMatchValue = Integer.parseInt(splitConfig.get("max_match_value")); long maxMatchValue = Long.parseLong(splitConfig.get("max_match_value"));
return splitNum <= maxMatchValue; return splitNum <= maxMatchValue;
} }
return false; return false;
...@@ -62,8 +62,8 @@ public class SplitUtil { ...@@ -62,8 +62,8 @@ public class SplitUtil {
if ("prefix".equalsIgnoreCase(matchWay)) { if ("prefix".equalsIgnoreCase(matchWay)) {
if (matcher.find()) { if (matcher.find()) {
String num = matcher.group(0); String num = matcher.group(0);
int splitNum = Integer.parseInt(num.replaceFirst("_", "")); long splitNum = Long.parseLong(num.replaceFirst("_", ""));
int maxMatchValue = Integer.parseInt(splitConfig.get("max_match_value")); long maxMatchValue = Long.parseLong(splitConfig.get("max_match_value"));
if (splitNum <= maxMatchValue) { if (splitNum <= maxMatchValue) {
return value.substring(0, value.lastIndexOf(num)); return value.substring(0, value.lastIndexOf(num));
} }
...@@ -76,15 +76,17 @@ public class SplitUtil { ...@@ -76,15 +76,17 @@ public class SplitUtil {
if (num == null) { if (num == null) {
return value; return value;
} }
int splitNum = Integer.parseInt(num.replaceFirst("_", "")); long splitNum = Long.parseLong(num.replaceFirst("_", ""));
int maxMatchValue = Integer.parseInt(splitConfig.get("max_match_value")); long maxMatchValue = Long.parseLong(splitConfig.get("max_match_value"));
if (splitNum <= maxMatchValue) { if (splitNum <= maxMatchValue) {
return value.substring(0, value.lastIndexOf(num)); return value.substring(0, value.lastIndexOf(num));
} }
} }
} catch (Exception ignored) { } catch (Exception exception) {
log.warn("Unable to determine sub-database sub-table"); log.warn(
"Unable to determine sub-database sub-table,reason is {}",
exception.getMessage());
} }
} }
return value; return value;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment