- java.lang.Object
-
- com.pervasive.datarush.functions.Arithmetic
-
public class Arithmetic extends Object
Provides implementations of common arithmetic functions. These functions can be combined to construct more complex mathematical expressions.The provided functions are polymorphic. That is, the type of the output depends on the types of the inputs. Arithmetic types follow the behavior of the analogous operations on Java primitive numeric types; the result is always of the widest of the input types.
- See Also:
ScalarValuedFunction
,DeriveFields
-
-
Constructor Summary
Constructors Constructor Description Arithmetic()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ScalarValuedFunction
add(double leftValue, ScalarValuedFunction rightExpr)
Builds an expression adding a constant to the value of the specified subexpression.static ScalarValuedFunction
add(double leftValue, String rightField)
Builds an expression adding a constant to the value of the specified field.static ScalarValuedFunction
add(ScalarValuedFunction leftExpr, double rightValue)
Builds an expression adding a constant to the value of the specified subexpression.static ScalarValuedFunction
add(ScalarValuedFunction leftExpr, ScalarValuedFunction rightExpr)
Builds an expression adding the values of the two specified subexpressions.static ScalarValuedFunction
add(ScalarValuedFunction leftExpr, String rightField)
Builds an expression adding a the value of the specified field and subexpression.static ScalarValuedFunction
add(String leftField, double rightValue)
Builds an expression adding a constant to the value of the specified field.static ScalarValuedFunction
add(String leftField, ScalarValuedFunction rightExpr)
Builds an expression adding a the value of the specified field and subexpression.static ScalarValuedFunction
add(String leftField, String rightField)
Builds an expression adding the values of the two specified fields.static ScalarValuedFunction
div(double leftValue, ScalarValuedFunction rightExpr)
Builds an expression dividing a constant by the value of the specified subexpression.static ScalarValuedFunction
div(double leftValue, String rightField)
Builds an expression dividing a constant by the value of the specified field.static ScalarValuedFunction
div(ScalarValuedFunction leftExpr, double rightValue)
Builds an expression dividing the value of the specified subexpression by a constant.static ScalarValuedFunction
div(ScalarValuedFunction leftExpr, ScalarValuedFunction rightExpr)
Builds an expression dividing the values of the two specified subexpressions.static ScalarValuedFunction
div(ScalarValuedFunction leftExpr, String rightField)
Builds an expression dividing a subexpression by the value of the specified field.static ScalarValuedFunction
div(String leftField, double rightValue)
Builds an expression dividing the value of the specified field by a constant.static ScalarValuedFunction
div(String leftField, ScalarValuedFunction rightExpr)
Builds an expression dividing the value of the specified field by a subexpression.static ScalarValuedFunction
div(String leftField, String rightField)
Builds an expression dividing the values of the two specified fields.static ScalarValuedFunction
mult(double leftValue, ScalarValuedFunction rightExpr)
Builds an expression multiplying the value of the specified subexpression by a constant.static ScalarValuedFunction
mult(double leftValue, String rightField)
Builds an expression multiplying the value of the specified field by a constant.static ScalarValuedFunction
mult(ScalarValuedFunction leftExpr, double rightValue)
Builds an expression multiplying the value of the specified subexpression by a constant.static ScalarValuedFunction
mult(ScalarValuedFunction leftExpr, ScalarValuedFunction rightExpr)
Builds an expression multiplying the values of the two specified subexpressions.static ScalarValuedFunction
mult(ScalarValuedFunction leftExpr, String rightField)
Builds an expression multiplying the values of the specified field and subexpression.static ScalarValuedFunction
mult(String leftField, double rightValue)
Builds an expression multiplying the value of the specified field by a constant.static ScalarValuedFunction
mult(String leftField, ScalarValuedFunction rightExpr)
Builds an expression multiplying the values of the specified field and subexpression.static ScalarValuedFunction
mult(String leftField, String rightField)
Builds an expression multiplying the values of the two specified fields.static ScalarValuedFunction
neg(ScalarValuedFunction expr)
Builds an expression negating the value of the specified subexpression.static ScalarValuedFunction
neg(String field)
Builds an expression negating the value of the specified field.static ScalarValuedFunction
remainder(double leftValue, ScalarValuedFunction rightExpr)
Builds an expression dividing a constant by the value of the specified subexpression and returning the remainder.static ScalarValuedFunction
remainder(double leftValue, String rightField)
Builds an expression dividing a constant by the value of the specified field and returning the remainder.static ScalarValuedFunction
remainder(ScalarValuedFunction leftExpr, double rightValue)
Builds an expression dividing the value of the specified subexpression by a constant and returning the remainder.static ScalarValuedFunction
remainder(ScalarValuedFunction leftExpr, ScalarValuedFunction rightExpr)
Builds an expression dividing the values of the two specified subexpressions and returning the remainder.static ScalarValuedFunction
remainder(ScalarValuedFunction leftExpr, String rightField)
Builds an expression dividing a subexpression by the value of the specified field and returning the remainder.static ScalarValuedFunction
remainder(String leftField, double rightValue)
Builds an expression dividing the value of the specified field by a constant and returning the remainder.static ScalarValuedFunction
remainder(String leftField, ScalarValuedFunction rightExpr)
Builds an expression dividing the value of the specified field by a subexpression and returning the remainder.static ScalarValuedFunction
remainder(String leftField, String rightField)
Builds an expression dividing the values of the two specified fields and returning the remainder.static ScalarValuedFunction
scaledDiv(ScalarValuedFunction leftExpr, ScalarValuedFunction rightExpr, int scale)
Builds an expression dividing the values of the two specified subexpressions to the specified scale.static ScalarValuedFunction
scaledDiv(ScalarValuedFunction leftExpr, String rightField, int scale)
Builds an expression dividing a subexpression by the value of the specified field to the specified scale.static ScalarValuedFunction
scaledDiv(String leftField, ScalarValuedFunction rightExpr, int scale)
Builds an expression dividing the value of the specified field by a subexpression to the specified scale.static ScalarValuedFunction
scaledDiv(String leftField, String rightField, int scale)
Builds an expression dividing the values of the two specified fields to the specified scale.static ScalarValuedFunction
scaledDiv(String leftField, BigDecimal rightValue, int scale)
Builds an expression dividing the value of the specified subexpression by a constant to the specified scale.static ScalarValuedFunction
scaledDiv(BigDecimal leftValue, String rightField, int scale)
Builds an expression dividing a constant by the value of the specified subexpression to the specified scale.static ScalarValuedFunction
sub(double leftValue, ScalarValuedFunction rightExpr)
Builds an expression subtracting the value of the specified subexpression from a constant.static ScalarValuedFunction
sub(double leftValue, String rightField)
Builds an expression subtracting the value of the specified field from a constant.static ScalarValuedFunction
sub(ScalarValuedFunction leftExpr, double rightValue)
Builds an expression subtracting a constant from the value of the specified subexpression.static ScalarValuedFunction
sub(ScalarValuedFunction leftExpr, ScalarValuedFunction rightExpr)
Builds an expression subtracting the values of the two specified subexpressions.static ScalarValuedFunction
sub(ScalarValuedFunction leftExpr, String rightField)
Builds an expression subtracting the value of the specified field from a subexpression.static ScalarValuedFunction
sub(String leftField, double rightValue)
Builds an expression subtracting a constant from the value of the specified field.static ScalarValuedFunction
sub(String leftField, ScalarValuedFunction rightExpr)
Builds an expression subtracting a subexpression from the value of the specified field.static ScalarValuedFunction
sub(String leftField, String rightField)
Builds an expression subtracting the values of the two specified fields.
-
-
-
Method Detail
-
neg
public static ScalarValuedFunction neg(String field)
Builds an expression negating the value of the specified field. The specified fields must be numeric. If the field value isnull
, the result isnull
.- Parameters:
field
- the record field value to negate- Returns:
- a function evaluating the expression
-
neg
public static ScalarValuedFunction neg(ScalarValuedFunction expr)
Builds an expression negating the value of the specified subexpression. The specified subexpression must be numeric. If the subexpression evaluates tonull
, the result isnull
.- Parameters:
expr
- the numeric expression to negate- Returns:
- a function evaluating the expression
-
add
public static ScalarValuedFunction add(String leftField, String rightField)
Builds an expression adding the values of the two specified fields. The specified fields must be numeric; the result type is the wider of the two input types. If either value isnull
, the result isnull
.- Parameters:
leftField
- the record field value on the left side of the additionrightField
- the record field value on the right side of the addition- Returns:
- a function evaluating the expression
-
add
public static ScalarValuedFunction add(String leftField, double rightValue)
Builds an expression adding a constant to the value of the specified field. The specified field must be numeric; the result type is the wider of the two input types. If the field value isnull
, the result isnull
.- Parameters:
leftField
- the record field value on the left side of the additionrightValue
- the constant value on the right side of the addition- Returns:
- a function evaluating the expression
-
add
public static ScalarValuedFunction add(double leftValue, String rightField)
Builds an expression adding a constant to the value of the specified field. The specified field must be numeric; the result type is the wider of the two input types. If the field value isnull
, the result isnull
.- Parameters:
leftValue
- the constant value on the left side of the additionrightField
- the record field value on the right side of the addition- Returns:
- a function evaluating the expression
-
add
public static ScalarValuedFunction add(String leftField, ScalarValuedFunction rightExpr)
Builds an expression adding a the value of the specified field and subexpression. The specified field and subexpression must be numeric; the result type is the wider of the two input types. If either input evaluates tonull
, the result isnull
.- Parameters:
leftField
- the record field value on the left side of the additionrightExpr
- the numeric expression on the right side of the addition- Returns:
- a function evaluating the expression
-
add
public static ScalarValuedFunction add(ScalarValuedFunction leftExpr, String rightField)
Builds an expression adding a the value of the specified field and subexpression. The specified field and subexpression must be numeric; the result type is the wider of the two input types. If either input evaluates tonull
, the result isnull
.- Parameters:
leftExpr
- the numeric expression on the left side of the additionrightField
- the record field value on the right side of the addition- Returns:
- a function evaluating the expression
-
add
public static ScalarValuedFunction add(double leftValue, ScalarValuedFunction rightExpr)
Builds an expression adding a constant to the value of the specified subexpression. The specified subexpression must be numeric; the result type is the wider of the two input types. If the subexpression evaluates tonull
, the result isnull
.- Parameters:
leftValue
- the constant value on the left side of the additionrightExpr
- the numeric expression on the right side of the addition- Returns:
- a function evaluating the expression
-
add
public static ScalarValuedFunction add(ScalarValuedFunction leftExpr, double rightValue)
Builds an expression adding a constant to the value of the specified subexpression. The specified subexpression must be numeric; the result type is the wider of the two input types. If the subexpression evaluates tonull
, the result isnull
.- Parameters:
leftExpr
- the numeric expression on the left side of the additionrightValue
- the constant value on the right side of the addition- Returns:
- a function evaluating the expression
-
add
public static ScalarValuedFunction add(ScalarValuedFunction leftExpr, ScalarValuedFunction rightExpr)
Builds an expression adding the values of the two specified subexpressions. The specified subexpressions must be numeric; the result type is the wider of the two input types. If either subexpression evaluates tonull
, the result isnull
.- Parameters:
leftExpr
- the numeric expression on the left side of the additionrightExpr
- the numeric expression on the right side of the addition- Returns:
- a function evaluating the expression
-
sub
public static ScalarValuedFunction sub(String leftField, String rightField)
Builds an expression subtracting the values of the two specified fields. The specified fields must be numeric; the result type is the wider of the two input types. If either value isnull
, the result isnull
.- Parameters:
leftField
- the record field value on the left side of the subtractionrightField
- the record field value on the right side of the subtraction- Returns:
- a function evaluating the expression
-
sub
public static ScalarValuedFunction sub(String leftField, double rightValue)
Builds an expression subtracting a constant from the value of the specified field. The specified field must be numeric; the result type is the wider of the two input types. If the field value isnull
, the result isnull
.- Parameters:
leftField
- the record field value on the left side of the subtractionrightValue
- the constant value on the right side of the subtraction- Returns:
- a function evaluating the expression
-
sub
public static ScalarValuedFunction sub(double leftValue, String rightField)
Builds an expression subtracting the value of the specified field from a constant. The specified field must be numeric; the result type is the wider of the two input types. If the field value isnull
, the result isnull
.- Parameters:
leftValue
- the constant value on the left side of the subtractionrightField
- the record field value on the right side of the subtraction- Returns:
- a function evaluating the expression
-
sub
public static ScalarValuedFunction sub(String leftField, ScalarValuedFunction rightExpr)
Builds an expression subtracting a subexpression from the value of the specified field. The specified field and subexpression must be numeric; the result type is the wider of the two input types. If either input evaluates tonull
, the result isnull
.- Parameters:
leftField
- the record field value on the left side of the subtractionrightExpr
- the numeric expression on the right side of the subtraction- Returns:
- a function evaluating the expression
-
sub
public static ScalarValuedFunction sub(ScalarValuedFunction leftExpr, String rightField)
Builds an expression subtracting the value of the specified field from a subexpression. The specified field and subexpression must be numeric; the result type is the wider of the two input types. If either input evaluates tonull
, the result isnull
.- Parameters:
leftExpr
- the numeric expression on the left side of the subtractionrightField
- the record field value on the right side of the subtraction- Returns:
- a function evaluating the expression
-
sub
public static ScalarValuedFunction sub(double leftValue, ScalarValuedFunction rightExpr)
Builds an expression subtracting the value of the specified subexpression from a constant. The specified subexpression must be numeric; the result type is the wider of the two input types. If the field value isnull
, the result isnull
.- Parameters:
leftValue
- the constant value on the left side of the subtractionrightExpr
- the numeric expression on the right side of the subtraction- Returns:
- a function evaluating the expression
-
sub
public static ScalarValuedFunction sub(ScalarValuedFunction leftExpr, double rightValue)
Builds an expression subtracting a constant from the value of the specified subexpression. The specified subexpression must be numeric; the result type is the wider of the two input types. If the field value isnull
, the result isnull
.- Parameters:
leftExpr
- the numeric expression on the left side of the subtractionrightValue
- the constant value on the right side of the subtraction- Returns:
- a function evaluating the expression
-
sub
public static ScalarValuedFunction sub(ScalarValuedFunction leftExpr, ScalarValuedFunction rightExpr)
Builds an expression subtracting the values of the two specified subexpressions. The specified subexpressions must be numeric; the result type is the wider of the two input types. If either subexpression evaluates tonull
, the result isnull
.- Parameters:
leftExpr
- the numeric expression on the left side of the subtractionrightExpr
- the numeric expression on the right side of the subtraction- Returns:
- a function evaluating the expression
-
mult
public static ScalarValuedFunction mult(String leftField, String rightField)
Builds an expression multiplying the values of the two specified fields. The specified fields must be numeric; the result type is the wider of the two input types. If either value isnull
, the result isnull
.- Parameters:
leftField
- the record field value on the left side of the multiplicationrightField
- the record field value on the right side of the multiplication- Returns:
- a function evaluating the expression
-
mult
public static ScalarValuedFunction mult(String leftField, double rightValue)
Builds an expression multiplying the value of the specified field by a constant. The specified field must be numeric; the result type is the wider of the two input types. If the field value isnull
, the result isnull
.- Parameters:
leftField
- the record field value on the left side of the multiplicationrightValue
- the constant value on the right side of the multiplication- Returns:
- a function evaluating the expression
-
mult
public static ScalarValuedFunction mult(double leftValue, String rightField)
Builds an expression multiplying the value of the specified field by a constant. The specified field must be numeric; the result type is the wider of the two input types. If the field value isnull
, the result isnull
.- Parameters:
rightField
- the record field value on the right side of the multiplicationleftValue
- the constant value on the left side of the multiplication- Returns:
- a function evaluating the expression
-
mult
public static ScalarValuedFunction mult(String leftField, ScalarValuedFunction rightExpr)
Builds an expression multiplying the values of the specified field and subexpression. The specified field and subexpression must be numeric; the result type is the wider of the two input types. If either input evaluates tonull
, the result isnull
.- Parameters:
leftField
- the record field value on the left side of the multiplicationrightExpr
- the numeric expression on the right side of the multiplication- Returns:
- a function evaluating the expression
-
mult
public static ScalarValuedFunction mult(ScalarValuedFunction leftExpr, String rightField)
Builds an expression multiplying the values of the specified field and subexpression. The specified field and subexpression must be numeric; the result type is the wider of the two input types. If either input evaluates tonull
, the result isnull
.- Parameters:
leftExpr
- the numeric expression on the left side of the multiplicationrightField
- the record field value on the right side of the multiplication- Returns:
- a function evaluating the expression
-
mult
public static ScalarValuedFunction mult(double leftValue, ScalarValuedFunction rightExpr)
Builds an expression multiplying the value of the specified subexpression by a constant. The specified subexpression must be numeric; the result type is the wider of the two input types. If the subexpression evaluates tonull
, the result isnull
.- Parameters:
leftValue
- the constant value on the left side of the multiplicationrightExpr
- the numeric expression on the right side of the multiplication- Returns:
- a function evaluating the expression
-
mult
public static ScalarValuedFunction mult(ScalarValuedFunction leftExpr, double rightValue)
Builds an expression multiplying the value of the specified subexpression by a constant. The specified subexpression must be numeric; the result type is the wider of the two input types. If the subexpression evaluates tonull
, the result isnull
.- Parameters:
leftExpr
- the numeric expression on the left side of the multiplicationrightValue
- the constant value on the right side of the multiplication- Returns:
- a function evaluating the expression
-
mult
public static ScalarValuedFunction mult(ScalarValuedFunction leftExpr, ScalarValuedFunction rightExpr)
Builds an expression multiplying the values of the two specified subexpressions. The specified subexpressions must be numeric; the result type is the wider of the two input types. If either subexpression evalautes tonull
, the result isnull
.- Parameters:
leftExpr
- the numeric expression on the left side of the multiplicationrightExpr
- the numeric expression on the right side of the multiplication- Returns:
- a function evaluating the expression
-
div
public static ScalarValuedFunction div(String leftField, String rightField)
Builds an expression dividing the values of the two specified fields. The specified fields must be numeric; the result type is the wider of the two input types. If either value isnull
or if the divisor evaluates to0
, the result isnull
.- Parameters:
leftField
- the record field value on the left side of the divisionrightField
- the record field value on the right side of the division- Returns:
- a function evaluating the expression
-
div
public static ScalarValuedFunction div(String leftField, double rightValue)
Builds an expression dividing the value of the specified field by a constant. The specified field must be numeric; the result type is the wider of the two input types. If the field value isnull
, the result isnull
.- Parameters:
leftField
- the record field value on the left side of the divisionrightValue
- the constant value on the right side of the division- Returns:
- a function evaluating the expression
-
div
public static ScalarValuedFunction div(double leftValue, String rightField)
Builds an expression dividing a constant by the value of the specified field. The specified field must be numeric; the result type is the wider of the two input types. If the field value isnull
, the result isnull
.- Parameters:
leftValue
- the constant value on the left side of the divisionrightField
- the record field value on the right side of the division- Returns:
- a function evaluating the expression
-
div
public static ScalarValuedFunction div(String leftField, ScalarValuedFunction rightExpr)
Builds an expression dividing the value of the specified field by a subexpression. The specified field and subexpression must be numeric; the result type is the wider of the two input types. If either input evaluates tonull
or if the divisor evaluates to0
, the result isnull
.- Parameters:
leftField
- the record field value on the left side of the divisionrightExpr
- the numeric expression on the right side of the division- Returns:
- a function evaluating the expression
-
div
public static ScalarValuedFunction div(ScalarValuedFunction leftExpr, String rightField)
Builds an expression dividing a subexpression by the value of the specified field. The specified field and subexpression must be numeric; the result type is the wider of the two input types. If either input evaluates tonull
or the divisor evaluates to0
, the result isnull
.- Parameters:
leftExpr
- the numeric expression on the left side of the divisionrightField
- the record field value on the right side of the division- Returns:
- a function evaluating the expression
-
div
public static ScalarValuedFunction div(double leftValue, ScalarValuedFunction rightExpr)
Builds an expression dividing a constant by the value of the specified subexpression. The specified subexpression must be numeric; the result type is the wider of the two input types. If the subexpression evaluates tonull
or0
, the result isnull
.- Parameters:
leftValue
- the constant value on the left side of the divisionrightExpr
- the numeric expression on the right side of the division- Returns:
- a function evaluating the expression
-
div
public static ScalarValuedFunction div(ScalarValuedFunction leftExpr, double rightValue)
Builds an expression dividing the value of the specified subexpression by a constant. The specified subexpression must be numeric; the result type is the wider of the two input types.- Parameters:
leftExpr
- the numeric expression on the left side of the divisionrightValue
- the constant value on the right side of the division- Returns:
- a function evaluating the expression
-
div
public static ScalarValuedFunction div(ScalarValuedFunction leftExpr, ScalarValuedFunction rightExpr)
Builds an expression dividing the values of the two specified subexpressions. The specified subexpressions must be numeric; the result type is the wider of the two input types. If either subexpression evaluates tonull
or if the divisor evaluates to0
, the result isnull
.Division will be done as appropriate for the result type; if both inputs are integer types, integer division will be used. To force floating point division in this case, convert one expression to floating point using
Conversions.asDouble(ScalarValuedFunction)
orConversions.asFloat(ScalarValuedFunction)
.- Parameters:
leftExpr
- the numeric expression on the left side of the divisionrightExpr
- the numeric expression on the right side of the division- Returns:
- a function evaluating the expression
-
scaledDiv
public static ScalarValuedFunction scaledDiv(String leftField, String rightField, int scale)
Builds an expression dividing the values of the two specified fields to the specified scale. The specified fields must be numeric; the result type will be numeric. If either value isnull
or if the divisor evaluates to0
, the result isnull
.- Parameters:
leftField
- the record field value on the left side of the divisionrightField
- the record field value on the right side of the divisionscale
- the scale, or precision, of the result- Returns:
- a function evaluating the expression
-
scaledDiv
public static ScalarValuedFunction scaledDiv(String leftField, BigDecimal rightValue, int scale)
Builds an expression dividing the value of the specified subexpression by a constant to the specified scale. The specified subexpression must be numeric; the result type will be numeric.- Parameters:
leftExpr
- the numeric expression on the left side of the divisionrightValue
- the constant value on the right side of the divisionscale
- the scale, or precision, of the result- Returns:
- a function evaluating the expression
-
scaledDiv
public static ScalarValuedFunction scaledDiv(BigDecimal leftValue, String rightField, int scale)
Builds an expression dividing a constant by the value of the specified subexpression to the specified scale. The specified subexpression must be numeric; the result type will be numeric. If the subexpression evaluates tonull
or0
, the result isnull
.- Parameters:
leftValue
- the constant value on the left side of the divisionrightExpr
- the numeric expression on the right side of the divisionscale
- the scale, or precision, of the result- Returns:
- a function evaluating the expression
-
scaledDiv
public static ScalarValuedFunction scaledDiv(String leftField, ScalarValuedFunction rightExpr, int scale)
Builds an expression dividing the value of the specified field by a subexpression to the specified scale. The specified field and subexpression must be numeric; the result type will be numeric. If either input evaluates tonull
or if the divisor evaluates to0
, the result isnull
.- Parameters:
leftField
- the record field value on the left side of the divisionrightExpr
- the numeric expression on the right side of the divisionscale
- the scale, or precision, of the result- Returns:
- a function evaluating the expression
-
scaledDiv
public static ScalarValuedFunction scaledDiv(ScalarValuedFunction leftExpr, String rightField, int scale)
Builds an expression dividing a subexpression by the value of the specified field to the specified scale. The specified field and subexpression must be numeric; the result will be numeric. If either input evaluates tonull
or the divisor evaluates to0
, the result isnull
.- Parameters:
leftExpr
- the numeric expression on the left side of the divisionrightField
- the record field value on the right side of the divisionscale
- the scale, or precision, of the result- Returns:
- a function evaluating the expression
-
scaledDiv
public static ScalarValuedFunction scaledDiv(ScalarValuedFunction leftExpr, ScalarValuedFunction rightExpr, int scale)
Builds an expression dividing the values of the two specified subexpressions to the specified scale. The specified subexpressions must be numeric; the result type will be numeric. If either subexpression evaluates tonull
or if the divisor evaluates to0
, the result isnull
.- Parameters:
leftExpr
- the numeric expression on the left side of the divisionrightExpr
- the numeric expression on the right side of the divisionscale
- the scale, or precision, of the result- Returns:
- a function evaluating the expression
-
remainder
public static ScalarValuedFunction remainder(String leftField, String rightField)
Builds an expression dividing the values of the two specified fields and returning the remainder. The specified fields must be numeric; the result type is the wider of the two input types. If either value isnull
or if the divisor evaluates to0
, the result isnull
.- Parameters:
leftField
- the record field value on the left side of the divisionrightField
- the record field value on the right side of the division- Returns:
- a function evaluating the expression
-
remainder
public static ScalarValuedFunction remainder(String leftField, double rightValue)
Builds an expression dividing the value of the specified field by a constant and returning the remainder. The specified field must be numeric; the result type is the wider of the two input types. If the field value isnull
, the result isnull
.- Parameters:
leftField
- the record field value on the left side of the divisionrightValue
- the constant value on the right side of the division- Returns:
- a function evaluating the expression
-
remainder
public static ScalarValuedFunction remainder(double leftValue, String rightField)
Builds an expression dividing a constant by the value of the specified field and returning the remainder. The specified field must be numeric; the result type is the wider of the two input types. If the field value isnull
, the result isnull
.- Parameters:
leftValue
- the constant value on the left side of the divisionrightField
- the record field value on the right side of the division- Returns:
- a function evaluating the expression
-
remainder
public static ScalarValuedFunction remainder(String leftField, ScalarValuedFunction rightExpr)
Builds an expression dividing the value of the specified field by a subexpression and returning the remainder. The specified field and subexpression must be numeric; the result type is the wider of the two input types. If either input evaluates tonull
or if the divisor evaluates to0
, the result isnull
.- Parameters:
leftField
- the record field value on the left side of the divisionrightExpr
- the numeric expression on the right side of the division- Returns:
- a function evaluating the expression
-
remainder
public static ScalarValuedFunction remainder(ScalarValuedFunction leftExpr, String rightField)
Builds an expression dividing a subexpression by the value of the specified field and returning the remainder. The specified field and subexpression must be numeric; the result type is the wider of the two input types. If either input evaluates tonull
or the divisor evaluates to0
, the result isnull
.- Parameters:
leftExpr
- the numeric expression on the left side of the divisionrightField
- the record field value on the right side of the division- Returns:
- a function evaluating the expression
-
remainder
public static ScalarValuedFunction remainder(double leftValue, ScalarValuedFunction rightExpr)
Builds an expression dividing a constant by the value of the specified subexpression and returning the remainder. The specified subexpression must be numeric; the result type is the wider of the two input types. If the subexpression evaluates tonull
or0
, the result isnull
.- Parameters:
leftValue
- the constant value on the left side of the divisionrightExpr
- the numeric expression on the right side of the division- Returns:
- a function evaluating the expression
-
remainder
public static ScalarValuedFunction remainder(ScalarValuedFunction leftExpr, double rightValue)
Builds an expression dividing the value of the specified subexpression by a constant and returning the remainder. The specified subexpression must be numeric; the result type is the wider of the two input types.- Parameters:
leftExpr
- the numeric expression on the left side of the divisionrightValue
- the constant value on the right side of the division- Returns:
- a function evaluating the expression
-
remainder
public static ScalarValuedFunction remainder(ScalarValuedFunction leftExpr, ScalarValuedFunction rightExpr)
Builds an expression dividing the values of the two specified subexpressions and returning the remainder. The specified subexpressions must be numeric; the result type is the wider of the two input types. If either subexpression evaluates tonull
or if the divisor evaluates to0
, the result isnull
.Division will be done as appropriate for the result type; if both inputs are integer types, integer division will be used. To force floating point division in this case, convert one expression to floating point using
Conversions.asDouble(ScalarValuedFunction)
orConversions.asFloat(ScalarValuedFunction)
.- Parameters:
leftExpr
- the numeric expression on the left side of the divisionrightExpr
- the numeric expression on the right side of the division- Returns:
- a function evaluating the expression
-
-