Class RoundSqlFunction
java.lang.Object
com.gigaspaces.query.sql.functions.SqlFunction
com.gigaspaces.query.sql.functions.RoundSqlFunction
Built in mathematical sql function to round the argument to nearest Integer.
- Since:
- 11.0.0
- Author:
- Tamir Schwarz
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(SqlFunctionExecutionContext context) Rounds the first argument context.getArgument(0) to the number of decimal places specified by context.getArgument(1).Methods inherited from class com.gigaspaces.query.sql.functions.SqlFunction
assertNumberOfArguments, assertNumberOfArguments, fromSqlTypeName, isString, isWholeNumber
-
Constructor Details
-
RoundSqlFunction
public RoundSqlFunction()
-
-
Method Details
-
apply
Rounds the first argument context.getArgument(0) to the number of decimal places specified by context.getArgument(1).- ROUND(1.298, 1) = 1.3
- ROUND(1.298, 0) = 1
- ROUND(23.298, -1) = 20
- Specified by:
applyin classSqlFunction- Parameters:
context- contains one or two arguments of type Number.- Returns:
- the value of the rounded argument context.getArgument(0) to context.getArgument(1) decimal places. The rounding algorithm depends on the data type of context.getArgument(0), context.getArgument(1) defaults to 0 if not specified. context.getArgument(1) can be negative to cause context.getArgument(1) digits left of the decimal point of the value context.getArgument(0) to become zero.
-