Class Round
java.lang.Object
dev.frostlake.functions.BuiltInFunction
dev.frostlake.functions.NumericArgumentFunction
dev.frostlake.functions.scalar.math.Round
ROUND(n [, scale [, mode]]) — the input rounded to
scale decimal places, zero by default.
The scale becomes the RESULT's declared scale as well as the value's, and a NULL scale — or a
NULL mode — makes the whole call NULL rather than meaning "no rounding". See RoundedValue.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanRejection(int position) ★ The MODE slot is not part of the numeric signature.Computes the function's result over its already-evaluated argument values.intThe most arguments a call to this function may pass;Integer.MAX_VALUEmarks a variadic function (seeBuiltInFunction.isVariadic()).intThe fewest arguments a call to this function may pass; fewer is an argument-count error.temporalRejection(int position) The same exemption for a DATE, TIME or TIMESTAMP mode — seebooleanRejection(int).Methods inherited from class dev.frostlake.functions.NumericArgumentFunction
binaryRejection, semiStructuredRejection, vectorRejectionMethods inherited from class dev.frostlake.functions.BuiltInFunction
approximateRejection, evaluate, fileRejection, geoRejection, getName, getReturnType, isVariadic, refusesMissingArgumentsByType, structuredRejection, temporalRejection, temporalRejection, textRejection, uuidRejection
-
Constructor Details
-
Round
public Round()
-
-
Method Details
-
evaluate
Description copied from class:BuiltInFunctionComputes the function's result over its already-evaluated argument values. A SQL NULL argument arrives as Javanull, and returningnullmakes the SQL result NULL.- Specified by:
evaluatein classBuiltInFunction- Parameters:
args- the argument values, in call order- Returns:
- the function's value for these arguments, or
nullfor SQL NULL
-
booleanRejection
★ The MODE slot is not part of the numeric signature. A BOOLEAN or a temporal value there is not the wrong TYPE but a mode that is not constant — live refusesROUND(n, 0, TRUE)andROUND(n, 0, CURRENT_DATE)as "needs to be constant", which the mode rule decides. An ARRAY, OBJECT or BINARY mode is still the wrong type, and so is a BOOLEAN in either numeric slot.- Overrides:
booleanRejectionin classNumericArgumentFunction- Parameters:
position- the zero-based argument position being asked about- Returns:
- the refusal this position gives a BOOLEAN value; by default none
-
temporalRejection
The same exemption for a DATE, TIME or TIMESTAMP mode — seebooleanRejection(int).- Overrides:
temporalRejectionin classNumericArgumentFunction- Parameters:
position- the zero-based argument position being asked about- Returns:
- the refusal this position gives a temporal value; by default none
-
getMinArgCount
public int getMinArgCount()Description copied from class:BuiltInFunctionThe fewest arguments a call to this function may pass; fewer is an argument-count error.- Specified by:
getMinArgCountin classBuiltInFunction- Returns:
- the minimum accepted argument count
-
getMaxArgCount
public int getMaxArgCount()Description copied from class:BuiltInFunctionThe most arguments a call to this function may pass;Integer.MAX_VALUEmarks a variadic function (seeBuiltInFunction.isVariadic()).- Specified by:
getMaxArgCountin classBuiltInFunction- Returns:
- the maximum accepted argument count
-