java.lang.Object
com.pervasive.datarush.functions.MapFunctions
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 ScalarValuedFunctionBuilds 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 ScalarValuedFunctionBuilds 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 ScalarValuedFunctionBuilds an expression to get the number of kay-value mappings in the specified field.static ScalarValuedFunctionBuilds 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.
-
Constructor Details
-
MapFunctions
public MapFunctions()
-
-
Method Details
-
mapGet
Builds an expression to get the value mapped to a key from specified field. The specified field must be of type Object<Map.class> and String respectively. The result will be of type Object. If the field value isnull, 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
Builds an expression to get the value mapped to a key from specified field. The specified field must be of type Object<Map.class> and String respectively. The result will be of type Object. If the field value isnull, 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
Builds an expression to get the value mapped to a key from specified constant. The specified field must be of type Object<Map.class> and String respectively. The result will be of type Object. If the constant value isnull, 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 Object<Map.class> and String respectively. The result will be of type Object. If the constant value isnull, 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
Builds an expression to get the value mapped to a key from specified ScalarValuedFunction. The specified field must be of type Object<Map.class> and String respectively. The result will be of type Object. If an expression evaluates tonull, 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 Object<Map.class> and String respectively. The result will be of type Object. If an expression evaluates tonull, 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
Builds an expression to get the number of kay-value mappings in the specified field. The specified field must be of type Object<Map.class> The result will be of type integer. If the field value isnull, the result isnull.- Parameters:
field- the record field value- Returns:
- a function evaluating the expression
-
mapSize
Builds an expression to get the number of kay-value mappings in ScalarValuedFunction expression. The specified constant must be of type Object<Map.class> The result will be of type integer. If an expression evaluates tonull, the result isnull.- Parameters:
expr- the ScalarValuedFunction expression- Returns:
- a function evaluating the expression
-
mapToString
Builds an expression to get the string representation of a specified field. The specified field must be of type Object<Map.class> The result will be of type String. If the field value isnull, the result isnull.- Parameters:
field- the record field value- Returns:
- a function evaluating the expression
-
mapToString
Builds an expression to get the string representation of a ScalarValuedFunction. The specified expression must evaluate to Object<Map.class> The result will be of type String. If an expression evaluates tonull, the result isnull.- Parameters:
expr- the ScalarValuedFunction expression- Returns:
- a function evaluating the expression
-
containsKey
Builds an expression to check if a field contains a mapping for the key specified by the other field. Operands must be of type Object<Map.class> and String. The result type is BOOLEAN. If the field representing a map isnull, 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
Builds an expression to check if a field contains a mapping for the key specified by an expression. Operands must be of type Object<Map.class> and String. The result type is BOOLEAN. If the field representing a map isnull, 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
Builds an expression to check if a constant contains a mapping for the key specified by the other field. Operands must be of type Object<Map.class> and String. The result type is BOOLEAN. If the constant representing a map isnull, 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 Object<Map.class> and String. The result type is BOOLEAN. If the constant representing a map isnull, 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
Builds an expression to check if an expression contains a mapping for the key specified by the other field. Operands must evaluate to Object<Map.class> and String. The result type is BOOLEAN. If an expression representing a map evaluates tonull, 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 Object<Map.class> and String. The result type is BOOLEAN. If an expression representing a map evaluates tonull, 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
-