- java.lang.Object
-
- com.pervasive.datarush.functions.MapFunctions
-
public class MapFunctions extends Object
Provides implementations of common Map functions. These functions can be combined to construct more complex expressions.These functions accept map objects as input parameters.
-
-
Constructor Summary
Constructors Constructor Description MapFunctions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ScalarValuedFunctioncontainsKey(ScalarValuedFunction leftExpr, ScalarValuedFunction rightExpr)Builds an expression to check if an expression contains a mapping for the key specified by the other expression.static ScalarValuedFunctioncontainsKey(ScalarValuedFunction leftExpr, String rightField)Builds an expression to check if an expression contains a mapping for the key specified by the other field.static ScalarValuedFunctioncontainsKey(String leftField, ScalarValuedFunction rightExpr)Builds an expression to check if a field contains a mapping for the key specified by an expression.static ScalarValuedFunctioncontainsKey(String leftField, String rightField)Builds an expression to check if a field contains a mapping for the key specified by the other field.static ScalarValuedFunctioncontainsKey(Map<Object,Object> leftValue, ScalarValuedFunction rightExpr)Builds an expression to check if a constant contains a mapping for the key specified by an expression.static ScalarValuedFunctioncontainsKey(Map<Object,Object> leftValue, String rightField)Builds an expression to check if a constant contains a mapping for the key specified by the other field.static ScalarValuedFunctionmapGet(ScalarValuedFunction leftExpr, ScalarValuedFunction rightExpr)Builds an expression to get the value mapped to a key from specified ScalarValuedFunction.static ScalarValuedFunctionmapGet(ScalarValuedFunction leftExpr, String rightField)Builds an expression to get the value mapped to a key from specified ScalarValuedFunction.static ScalarValuedFunctionmapGet(String leftField, ScalarValuedFunction rightExpr)Builds an expression to get the value mapped to a key from specified field.static ScalarValuedFunctionmapGet(String leftField, String rightField)Builds an expression to get the value mapped to a key from specified field.static ScalarValuedFunctionmapGet(Map<Object,Object> leftValue, ScalarValuedFunction rightExpr)Builds an expression to get the value mapped to a key from specified constant.static ScalarValuedFunctionmapGet(Map<Object,Object> leftValue, String rightField)Builds an expression to get the value mapped to a key from specified constant.static ScalarValuedFunctionmapSize(ScalarValuedFunction expr)Builds an expression to get the number of kay-value mappings in ScalarValuedFunction expression.static ScalarValuedFunctionmapSize(String field)Builds an expression to get the number of kay-value mappings in the specified field.static ScalarValuedFunctionmapToString(ScalarValuedFunction expr)Builds an expression to get the string representation of a ScalarValuedFunction.static ScalarValuedFunctionmapToString(String field)Builds an expression to get the string representation of a specified field.
-
-
-
Method Detail
-
mapGet
public static ScalarValuedFunction mapGet(String leftField, String rightField)
Builds an expression to get the value mapped to a key from specified field. The specified field must be of type Objectand String respectively. The result will be of type Object. If the field value is null, the result isnull.- Parameters:
leftField- the record field value on the left side of mapGetrightField- the record field value on the right side of mapGet- Returns:
- a function evaluating the expression
-
mapGet
public static ScalarValuedFunction mapGet(String leftField, ScalarValuedFunction rightExpr)
Builds an expression to get the value mapped to a key from specified field. The specified field must be of type Objectand String respectively. The result will be of type Object. If the field value is null, the result isnull.- Parameters:
leftField- the record field value on the left side of mapGetrightExpr- the ScalarValuedFunction expression on the right side of mapGet- Returns:
- a function evaluating the expression
-
mapGet
public static ScalarValuedFunction mapGet(Map<Object,Object> leftValue, String rightField)
Builds an expression to get the value mapped to a key from specified constant. The specified field must be of type Objectand String respectively. The result will be of type Object. If the constant value is null, the result isnull.- Parameters:
leftValue- the constant value on the left side of mapGetrightField- the record field value on the right side of mapGet- Returns:
- a function evaluating the expression
-
mapGet
public static ScalarValuedFunction mapGet(Map<Object,Object> leftValue, ScalarValuedFunction rightExpr)
Builds an expression to get the value mapped to a key from specified constant. The specified field must be of type Objectand String respectively. The result will be of type Object. If the constant value is null, the result isnull.- Parameters:
leftValue- the constant value on the left side of mapGetrightExpr- the ScalarValuedFunction expression on the right side of mapGet- Returns:
- a function evaluating the expression
-
mapGet
public static ScalarValuedFunction mapGet(ScalarValuedFunction leftExpr, String rightField)
Builds an expression to get the value mapped to a key from specified ScalarValuedFunction. The specified field must be of type Objectand String respectively. The result will be of type Object. If an expression evaluates to null, the result isnull.- Parameters:
leftExpr- the ScalarValuedFunction expression on the left side of mapGetrightField- the record field value on the right side of mapGet- Returns:
- a function evaluating the expression
-
mapGet
public static ScalarValuedFunction mapGet(ScalarValuedFunction leftExpr, ScalarValuedFunction rightExpr)
Builds an expression to get the value mapped to a key from specified ScalarValuedFunction. The specified field must be of type Objectand String respectively. The result will be of type Object. If an expression evaluates to null, the result isnull.- Parameters:
leftExpr- the ScalarValuedFunction expression on the left side of mapGetrightExpr- the ScalarValuedFunction expression on the right side of mapGet- Returns:
- a function evaluating the expression
-
mapSize
public static ScalarValuedFunction mapSize(String field)
Builds an expression to get the number of kay-value mappings in the specified field. The specified field must be of type ObjectThe result will be of type integer. If the field value is null, the result isnull.- Parameters:
field- the record field value- Returns:
- a function evaluating the expression
-
mapSize
public static ScalarValuedFunction mapSize(ScalarValuedFunction expr)
Builds an expression to get the number of kay-value mappings in ScalarValuedFunction expression. The specified constant must be of type ObjectThe result will be of type integer. If an expression evaluates to null, the result isnull.- Parameters:
expr- the ScalarValuedFunction expression- Returns:
- a function evaluating the expression
-
mapToString
public static ScalarValuedFunction mapToString(String field)
Builds an expression to get the string representation of a specified field. The specified field must be of type ObjectThe result will be of type String. If the field value is null, the result isnull.- Parameters:
field- the record field value- Returns:
- a function evaluating the expression
-
mapToString
public static ScalarValuedFunction mapToString(ScalarValuedFunction expr)
Builds an expression to get the string representation of a ScalarValuedFunction. The specified expression must evaluate to ObjectThe result will be of type String. If an expression evaluates to null, the result isnull.- Parameters:
expr- the ScalarValuedFunction expression- Returns:
- a function evaluating the expression
-
containsKey
public static ScalarValuedFunction containsKey(String leftField, String rightField)
Builds an expression to check if a field contains a mapping for the key specified by the other field. Operands must be of type Objectand String. The result type is BOOLEAN. If the field representing a map is null, the result isnull.- Parameters:
leftField- the record field value on the left side of containsKeyrightField- the record field value on the right side of containsKey- Returns:
- a function evaluating the expression
-
containsKey
public static ScalarValuedFunction containsKey(String leftField, ScalarValuedFunction rightExpr)
Builds an expression to check if a field contains a mapping for the key specified by an expression. Operands must be of type Objectand String. The result type is BOOLEAN. If the field representing a map is null, the result isnull.- Parameters:
leftField- the record field value on the left side of containsKeyrightExpr- the ScalarValuedFunction expression on the right side of containsKey- Returns:
- a function evaluating the expression
-
containsKey
public static ScalarValuedFunction containsKey(Map<Object,Object> leftValue, String rightField)
Builds an expression to check if a constant contains a mapping for the key specified by the other field. Operands must be of type Objectand String. The result type is BOOLEAN. If the constant representing a map is null, the result isnull.- Parameters:
leftValue- the constant value on the left side of containsKeyrightField- the record field value on the right side of containsKey- Returns:
- a function evaluating the expression
-
containsKey
public static ScalarValuedFunction containsKey(Map<Object,Object> leftValue, ScalarValuedFunction rightExpr)
Builds an expression to check if a constant contains a mapping for the key specified by an expression. Operands must evaluate to Objectand String. The result type is BOOLEAN. If the constant representing a map is null, the result isnull.- Parameters:
leftValue- the constant value on the left side of containsKeyrightExpr- the ScalarValuedFunction expression on the right side of containsKey- Returns:
- a function evaluating the expression
-
containsKey
public static ScalarValuedFunction containsKey(ScalarValuedFunction leftExpr, String rightField)
Builds an expression to check if an expression contains a mapping for the key specified by the other field. Operands must evaluate to Objectand String. The result type is BOOLEAN. If an expression representing a map evaluates to null, the result isnull.- Parameters:
leftExpr- the ScalarValuedFunction expression on the left side of containsKeyrightField- the record field value on the right side of containsKey- Returns:
- a function evaluating the expression
-
containsKey
public static ScalarValuedFunction containsKey(ScalarValuedFunction leftExpr, ScalarValuedFunction rightExpr)
Builds an expression to check if an expression contains a mapping for the key specified by the other expression. Operands must evaluate to Objectand String. The result type is BOOLEAN. If an expression representing a map evaluates to null, the result isnull.- Parameters:
leftExpr- the ScalarValuedFunction expression on the left side of containsKeyrightExpr- the ScalarValuedFunction expression on the left side of containsKey- Returns:
- a function evaluating the expression
-
-