Class RoundSqlFunction

java.lang.Object
com.gigaspaces.query.sql.functions.SqlFunction
com.gigaspaces.query.sql.functions.RoundSqlFunction

public class RoundSqlFunction extends SqlFunction
Built in mathematical sql function to round the argument to nearest Integer.
Since:
11.0.0
Author:
Tamir Schwarz
  • Constructor Details

    • RoundSqlFunction

      public RoundSqlFunction()
  • Method Details

    • apply

      public Object apply(SqlFunctionExecutionContext context)
      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:
      apply in class SqlFunction
      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.