use of com.facebook.presto.common.type.DecimalParseResult in project presto by prestodb.
the class AbstractTestFunctions method decimal.
protected static SqlDecimal decimal(String decimalString) {
DecimalParseResult parseResult = Decimals.parseIncludeLeadingZerosInPrecision(decimalString);
BigInteger unscaledValue;
if (parseResult.getType().isShort()) {
unscaledValue = BigInteger.valueOf((Long) parseResult.getObject());
} else {
unscaledValue = Decimals.decodeUnscaledValue((Slice) parseResult.getObject());
}
return new SqlDecimal(unscaledValue, parseResult.getType().getPrecision(), parseResult.getType().getScale());
}
use of com.facebook.presto.common.type.DecimalParseResult in project urban-eureka by errir503.
the class AbstractTestFunctions method decimal.
protected static SqlDecimal decimal(String decimalString) {
DecimalParseResult parseResult = Decimals.parseIncludeLeadingZerosInPrecision(decimalString);
BigInteger unscaledValue;
if (parseResult.getType().isShort()) {
unscaledValue = BigInteger.valueOf((Long) parseResult.getObject());
} else {
unscaledValue = Decimals.decodeUnscaledValue((Slice) parseResult.getObject());
}
return new SqlDecimal(unscaledValue, parseResult.getType().getPrecision(), parseResult.getType().getScale());
}
Aggregations