....Continue from Part 2....
Function used in expanded mode
Expanded mode provides more control over the transform. It lets you edit the expanded package, so you can specify transformations that are not possible with template mode
With an expanded ROLLUP package, you must define the following function in it:
DML type named temporary_type
initialize function that returns a temporary_type record
rollup function that takes two input arguments (an input record and a temporary_type record) and returns an updated temporary_type record
finalize function that returns an output record
Runtime behavior of ROLLUP
ROLLUP perform following operation for each group of records:
1. Performing Input selection:
- If you have not defined the input_select function in your transform, ROLLUP processes all records.
- If you have defined the input_select function, ROLLUP filters the input records accordingly.
2. Performing Key change (for sorted input only):
- For every record except the first, ROLLUP checks whether a key change has occurred:
- ROLLUP compares the current record’s key value to the previous record’s key value, unless the key_change function is defined.
- If the key_change function is defined, ROLLUP calls that function to check for a key change.
3. Temporary initialization:
- ROLLUP passes the first record in each group to the initialize transform function.
4. Performing Computation:
- ROLLUP calls the rollup transform function for each input record.
- The input to the rollup transform function is the input record and the temporary record for the group to which the input record belongs.
- The rollup transform function returns an updated temporary record for that input group.
5. Performing Finalization of the output:
With sorted-input set to True:
- ROLLUP calls the finalize transform function after it processes all the input records in each group.
- ROLLUP passes the temporary record for the group and the last input record in the group to the finalize transform function.
- The finalize transform function produces an output record for the group.
Note:
- For sorted-input set to False ROLLUP processes all the input records, it calls the finalize transform function with the temporary record for each group and an arbitrary input record from each group as arguments.
- ROLLUP repeats this procedure with each group.
- The finalize transform function then produces an output record for each group.
- The component stops the execution of the graph when the number of reject events exceeds the result of the following formula:
limit+(ramp* number_of_records_processed_so_far)
6. Output selection:
- If you have defined the output_select transform function, it filters the output records.