if (args.size() != 3) {
StringBuilder err = new StringBuilder();
for (int i = 0; i < args.size(); i++) {
err.append("arg" + i + ": " + args.get(i).getMajorType().getMinorType());
}
throw new DrillRuntimeException("Decimal cast function invoked with incorect arguments" + err);
}
int scale = (int) ((ValueExpressions.LongExpression)(args.get(args.size() - 1))).getLong();
int precision = (int) ((ValueExpressions.LongExpression)(args.get(args.size() - 2))).getLong();
return (TypeProtos.MajorType.newBuilder().setMinorType(returnValue.type.getMinorType()).setScale(scale).setPrecision(precision).setMode(mode).build());