Change in asterixdb[master]: Fix Numeric Overflow For Units > GB
Michael Blow has submitted this change and it was merged. Change subject: Fix Numeric Overflow For Units > GB .. Fix Numeric Overflow For Units > GB refactoring / cleanup handle negative numbers Change-Id: Id5a3896ebfb38fc565b3524beed940dfbbf81d4f Reviewed-on: https://asterix-gerrit.ics.uci.edu/1084 Sonar-Qube: JenkinsTested-by: Jenkins Integration-Tests: Jenkins Reviewed-by: Taewoo Kim --- M asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/PropertyInterpreters.java M hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/StorageUtil.java 2 files changed, 69 insertions(+), 145 deletions(-) Approvals: Taewoo Kim: Looks good to me, approved Jenkins: Verified; No violations found; Verified diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/PropertyInterpreters.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/PropertyInterpreters.java index 4dd07d8..6703fcd 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/PropertyInterpreters.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/PropertyInterpreters.java @@ -25,93 +25,41 @@ public class PropertyInterpreters { public static IPropertyInterpreter getIntegerPropertyInterpreter() { -return new IPropertyInterpreter() { -@Override -public Integer interpret(String s) throws IllegalArgumentException { -try { -return Integer.parseInt(s); -} catch (NumberFormatException e) { -throw new IllegalArgumentException(e); -} -} -}; +return Integer::parseInt; } public static IPropertyInterpreter getBooleanPropertyInterpreter() { -return new IPropertyInterpreter() { -@Override -public Boolean interpret(String s) throws IllegalArgumentException { -return Boolean.parseBoolean(s); -} -}; +return Boolean::parseBoolean; } public static IPropertyInterpreter getLongPropertyInterpreter() { -return new IPropertyInterpreter() { -@Override -public Long interpret(String s) throws IllegalArgumentException { -try { -return Long.parseLong(s); -} catch (NumberFormatException e) { -throw new IllegalArgumentException(e); -} -} -}; +return Long::parseLong; } public static IPropertyInterpreter getLevelPropertyInterpreter() { -return new IPropertyInterpreter() { -@Override -public Level interpret(String s) throws IllegalArgumentException { -return Level.parse(s); -} -}; +return Level::parse; } public static IPropertyInterpreter getStringPropertyInterpreter() { -return new IPropertyInterpreter() { -@Override -public String interpret(String s) throws IllegalArgumentException { -return s; -} -}; +return s -> s; } public static IPropertyInterpreter getDoublePropertyInterpreter() { -return new IPropertyInterpreter() { -@Override -public Double interpret(String s) throws IllegalArgumentException { -try { -return Double.parseDouble(s); -} catch (NumberFormatException e) { -throw new IllegalArgumentException(e); -} -} -}; +return Double::parseDouble; } public static IPropertyInterpreter getLongBytePropertyInterpreter() { -return new IPropertyInterpreter() { -@Override -public Long interpret(String s) throws IllegalArgumentException { -try { -return StorageUtil.getByteValue(s); -} catch (NumberFormatException e) { -throw new IllegalArgumentException(e); -} -} -}; +return StorageUtil::getByteValue; } public static IPropertyInterpreter getIntegerBytePropertyInterpreter() { -return new IPropertyInterpreter() { -@Override -public Integer interpret(String s) throws IllegalArgumentException { -try { -return (int) StorageUtil.getByteValue(s); -} catch (NumberFormatException e) { -throw new IllegalArgumentException(e); -} +return s -> { +long result = StorageUtil.getByteValue(s); +
Change in asterixdb[master]: Fix Numeric Overflow For Units > GB
Taewoo Kim has posted comments on this change. Change subject: Fix Numeric Overflow For Units > GB .. Patch Set 3: Code-Review+2 LGTM -- To view, visit https://asterix-gerrit.ics.uci.edu/1084 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id5a3896ebfb38fc565b3524beed940dfbbf81d4f Gerrit-PatchSet: 3 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Michael BlowGerrit-Reviewer: Jenkins Gerrit-Reviewer: Taewoo Kim Gerrit-Reviewer: Till Westmann Gerrit-HasComments: No
Change in asterixdb[master]: Fix Numeric Overflow For Units > GB
Jenkins has posted comments on this change. Change subject: Fix Numeric Overflow For Units > GB .. Patch Set 3: Integration-Tests+1 Integration Tests Successful https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/385/ : SUCCESS -- To view, visit https://asterix-gerrit.ics.uci.edu/1084 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id5a3896ebfb38fc565b3524beed940dfbbf81d4f Gerrit-PatchSet: 3 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Michael BlowGerrit-Reviewer: Jenkins Gerrit-Reviewer: Till Westmann Gerrit-HasComments: No
Change in asterixdb[master]: Fix Numeric Overflow For Units > GB
Jenkins has posted comments on this change. Change subject: Fix Numeric Overflow For Units > GB .. Patch Set 3: Integration-Tests-1 Integration Tests Failed https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/343/ : UNSTABLE -- To view, visit https://asterix-gerrit.ics.uci.edu/1084 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id5a3896ebfb38fc565b3524beed940dfbbf81d4f Gerrit-PatchSet: 3 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Michael BlowGerrit-Reviewer: Jenkins Gerrit-Reviewer: Till Westmann Gerrit-HasComments: No
Change in asterixdb[master]: Fix Numeric Overflow For Units > GB
Jenkins has posted comments on this change. Change subject: Fix Numeric Overflow For Units > GB .. Patch Set 1: Integration-Tests+1 Integration Tests Successful https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/342/ : SUCCESS -- To view, visit https://asterix-gerrit.ics.uci.edu/1084 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id5a3896ebfb38fc565b3524beed940dfbbf81d4f Gerrit-PatchSet: 1 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Michael BlowGerrit-Reviewer: Jenkins Gerrit-Reviewer: Till Westmann Gerrit-HasComments: No
Change in asterixdb[master]: Fix Numeric Overflow For Units > GB
Jenkins has posted comments on this change. Change subject: Fix Numeric Overflow For Units > GB .. Patch Set 3: WARNING: THIS CHANGE CONTAINS CROSS-PRODUCT CHANGES IN: * asterixdb * hyracks-fullstack PLEASE REVIEW CAREFULLY AND LOOK FOR API CHANGES! -- To view, visit https://asterix-gerrit.ics.uci.edu/1084 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id5a3896ebfb38fc565b3524beed940dfbbf81d4f Gerrit-PatchSet: 3 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Michael BlowGerrit-Reviewer: Jenkins Gerrit-Reviewer: Till Westmann Gerrit-HasComments: No
Change in asterixdb[master]: Fix Numeric Overflow For Units > GB
Jenkins has posted comments on this change. Change subject: Fix Numeric Overflow For Units > GB .. Patch Set 3: Build Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-notopic/2252/ -- To view, visit https://asterix-gerrit.ics.uci.edu/1084 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id5a3896ebfb38fc565b3524beed940dfbbf81d4f Gerrit-PatchSet: 3 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Michael BlowGerrit-Reviewer: Jenkins Gerrit-Reviewer: Till Westmann Gerrit-HasComments: No
Change in asterixdb[master]: Fix Numeric Overflow For Units > GB
Jenkins has posted comments on this change. Change subject: Fix Numeric Overflow For Units > GB .. Patch Set 2: WARNING: THIS CHANGE CONTAINS CROSS-PRODUCT CHANGES IN: * asterixdb * hyracks-fullstack PLEASE REVIEW CAREFULLY AND LOOK FOR API CHANGES! -- To view, visit https://asterix-gerrit.ics.uci.edu/1084 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id5a3896ebfb38fc565b3524beed940dfbbf81d4f Gerrit-PatchSet: 2 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Michael BlowGerrit-Reviewer: Jenkins Gerrit-Reviewer: Till Westmann Gerrit-HasComments: No
Change in asterixdb[master]: Fix Numeric Overflow For Units > GB
Jenkins has posted comments on this change. Change subject: Fix Numeric Overflow For Units > GB .. Patch Set 1: Integration Tests Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/342/ -- To view, visit https://asterix-gerrit.ics.uci.edu/1084 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id5a3896ebfb38fc565b3524beed940dfbbf81d4f Gerrit-PatchSet: 1 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Michael BlowGerrit-Reviewer: Jenkins Gerrit-Reviewer: Till Westmann Gerrit-HasComments: No
Change in asterixdb[master]: Fix Numeric Overflow For Units > GB
Till Westmann has posted comments on this change. Change subject: Fix Numeric Overflow For Units > GB .. Patch Set 1: (1 comment) https://asterix-gerrit.ics.uci.edu/#/c/1084/1/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/StorageUtil.java File hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/StorageUtil.java: Line 149: * @throws IllegalStateException Also throws IllegalArgumentException - maybe we should unify? -- To view, visit https://asterix-gerrit.ics.uci.edu/1084 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id5a3896ebfb38fc565b3524beed940dfbbf81d4f Gerrit-PatchSet: 1 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Michael BlowGerrit-Reviewer: Jenkins Gerrit-Reviewer: Till Westmann Gerrit-HasComments: Yes
Change in asterixdb[master]: Fix Numeric Overflow For Units > GB
Jenkins has posted comments on this change. Change subject: Fix Numeric Overflow For Units > GB .. Patch Set 1: Build Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-notopic/2250/ -- To view, visit https://asterix-gerrit.ics.uci.edu/1084 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id5a3896ebfb38fc565b3524beed940dfbbf81d4f Gerrit-PatchSet: 1 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Michael BlowGerrit-Reviewer: Jenkins Gerrit-HasComments: No
Change in asterixdb[master]: Fix Numeric Overflow For Units > GB
Michael Blow has uploaded a new change for review. https://asterix-gerrit.ics.uci.edu/1084 Change subject: Fix Numeric Overflow For Units > GB .. Fix Numeric Overflow For Units > GB Change-Id: Id5a3896ebfb38fc565b3524beed940dfbbf81d4f --- M hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/StorageUtil.java 1 file changed, 3 insertions(+), 3 deletions(-) git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/84/1084/1 diff --git a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/StorageUtil.java b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/StorageUtil.java index 7025f15..c33d33e 100644 --- a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/StorageUtil.java +++ b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/StorageUtil.java @@ -20,7 +20,7 @@ public class StorageUtil { -private static final int BASE = 1024, KB = BASE, MB = KB * BASE, GB = MB * BASE, TB = GB * BASE, PB = TB * BASE; +private static final long BASE = 1024, KB = BASE, MB = KB * BASE, GB = MB * BASE, TB = GB * BASE, PB = TB * BASE; public enum StorageUnit { BYTE("B"), @@ -87,7 +87,7 @@ * Helper method to parse a byte unit string to its double value and unit * (e.g., 10,345.8MB becomes Pair<10345.8, StorageUnit.MB>.) * - * @throws HyracksException + * @throws IllegalStateException */ public static ByteValueStringInfo parseByteUnitString(String s) { String sSpaceRemoved = s.replaceAll(" ", ""); @@ -146,7 +146,7 @@ /** * Return byte value for the given string (e.g., 0.1KB, 100kb, 1mb, 3MB, 8.5GB ...) * - * @throws HyracksException + * @throws IllegalStateException */ public static long getByteValue(String s) { try { -- To view, visit https://asterix-gerrit.ics.uci.edu/1084 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id5a3896ebfb38fc565b3524beed940dfbbf81d4f Gerrit-PatchSet: 1 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Michael Blow