if (counterName.toUpperCase().endsWith(fsCounter.name())) { try { counterValue = getCounterValue(counterValueStr, new Validator.SizeValidator()); if (counterValue < 0) { throw new IllegalArgumentException("Illegal value for counter limit. Expected a positive long value.");
@Override public String validate(String value) { try { long size = HiveConf.toSizeBytes(value); if (min != null && (minInclusive ? size < min : size <= min)) { return value + " is smaller than " + sizeString(min); } if (max != null && (maxInclusive ? size > max : size >= max)) { return value + " is bigger than " + sizeString(max); } } catch (Exception e) { return e.toString(); } return null; }
public String toDescription() { String description = "Expects a byte size value with unit (blank for bytes, kb, mb, gb, tb, pb)"; if (min != null && max != null) { description += ".\nThe size should be in between " + sizeString(min) + (minInclusive ? " (inclusive)" : " (exclusive)") + " and " + sizeString(max) + (maxInclusive ? " (inclusive)" : " (exclusive)"); } else if (min != null) { description += ".\nThe time should be bigger than " + (minInclusive ? "or equal to " : "") + sizeString(min); } else if (max != null) { description += ".\nThe size should be smaller than " + (maxInclusive ? "or equal to " : "") + sizeString(max); } return description; }
@Override public String validate(String value) { try { long size = HiveConf.toSizeBytes(value); if (min != null && (minInclusive ? size < min : size <= min)) { return value + " is smaller than " + sizeString(min); } if (max != null && (maxInclusive ? size > max : size >= max)) { return value + " is bigger than " + sizeString(max); } } catch (Exception e) { return e.toString(); } return null; }
public String toDescription() { String description = "Expects a byte size value with unit (blank for bytes, kb, mb, gb, tb, pb)"; if (min != null && max != null) { description += ".\nThe size should be in between " + sizeString(min) + (minInclusive ? " (inclusive)" : " (exclusive)") + " and " + sizeString(max) + (maxInclusive ? " (inclusive)" : " (exclusive)"); } else if (min != null) { description += ".\nThe time should be bigger than " + (minInclusive ? "or equal to " : "") + sizeString(min); } else if (max != null) { description += ".\nThe size should be smaller than " + (maxInclusive ? "or equal to " : "") + sizeString(max); } return description; }