Big Data Management User Guide > Processing Hierarchical Data on the Spark Engine > Complex Operators
  

Complex Operators

A complex operator is a type of operator to access elements in a complex data type. The transformation language includes complex operators for complex data types. Use complex operators to access or extract elements in hierarchical data.
The following table lists the complex operators:
Complex Operators
Description
[]
Subscript operator. Use to access array and map elements.
Syntax: array[index]
  • - array is the array from which you want to access an element.
  • - index is the position of an element within an array.
For example, use [0] to access the first element in an one-dimensional array.
Syntax: map[key]
  • - map is the map from which you want to access the value corresponding to a key.
  • - key is the map key for which you want to retrieve the map value.
.
Dot operator. Use to access struct elements.
Syntax: struct.element_name
  • - struct is the struct from which you want to access an element.
  • - element_name is the name of the struct element.
Use complex operators in expressions to convert hierarchical data to relational data.
For more information about the operator syntax, return values, and examples, see the Informatica Developer Transformation Language Reference.

Complex Operator Examples

Extracting an Array Element Using a Subscript Operator

Use the subscript operator in expressions to extract one or more elements of an array.
    1. In the transformation, create an output port of the same data type as the return value of the array element that you want to extract.
    To extract more than one element in an array, create an array output port. The data type of the elements in the type configuration for the array port must match the data type of the return value of the array elements.
    2. In the Expression column for the output port, click the Open button.
    The Expression Editor opens.
    3. Delete the existing expression in the editor.
    4. Click the Ports tab and select an array port.
    5. Enter one or more index values within the subscript operator.
    To extract array elements in a multidimensional array, enter index values within each subscript operator.
    6. Click Validate to validate the expression.
    7. Click OK to exit the Validate Expression dialog box.
    8. Click OK to exit the Expression Editor.

Extracting a Struct Element Using the Dot Operator

Use the dot operator in expressions to extract elements of a struct.
    1. In the transformation, create an output port of the same data type as the return value of the struct element that you want to extract.
    2. In the Expression column for the output port, click the Open button.
    The Expression Editor opens.
    3. Delete the existing expression in the editor.
    4. Click the Ports tab and select the struct port.
    5. Enter a dot after the port name.
    The Developer tool displays a list of elements in the struct.
    The Expression Editor shows a list of elements in the struct.
    6. Select the element that you want to extract.
    7. Click Validate to validate the expression.
    8. Click OK to exit the Validate Expression dialog box.
    9. Click OK to exit the Expression Editor.