Using the Group By step on the Pentaho engine
If you are running your transformation on the Pentaho engine, use the following instructions to set up the Group By step.
Enter the information in the options as shown in the following table:
|Step name||Specifies the unique name of the Group By step on the canvas. You can customize the name or leave it as the default.|
|Include all rows?||
Select this check box if you want to include all rows in the output. Clear this check box if you only want to output the aggregate rows.
The following options are not available unless the Include all rows option is selected:
|Temporary files directory||Specify the directory where the temporary files are stored. The default is the standard temporary directory for the system. You must specify a directory when the Include all rows option is selected and the number of grouped rows exceeds 5000 rows.|
|TMP-file prefix||Specifies the file prefix for naming temporary files.|
|Add line number, restart in each group||Adds a line number that restarts at 1 in each group. When both Include all rows and this option are selected, all rows are included in the output with a line number for each row.|
|Line number field name||Specifies the name of the field where you want to add line numbers for each new group.|
|Always give back a result row||Select this check box to return a result row, even when there is no input row. When there are no input rows, this option returns a count of zero (0). Clear this check box if you only want to output a result row when there is an input row.|
The fields that make up the group table
Use The fields that make up the group table to specify the fields you want to group. Click Get Fields to add all fields from the input stream(s) to the table. Right-click a row in the table to edit that row or all rows in the table.
The Aggregates table specifies the group you want to aggregate, the aggregation method, and the name of the resulting new field.
The Aggregates table contains the following columns:
|Name||The name of the aggregate field.|
|Subject||The subject on which you want to use an aggregation method.|
The aggregate method.
The aggregation methods are:
|Value||The aggregate value.|
Examples included in the design-tools\data-integration\samples\transformations directory are:
- Calculate median and percentiles using the group by steps.ktr
- General - Repeat fields - Group by - Denormalize.ktr
- Group By - Calculate standard deviation.ktr
- Group By - include all rows without a grouping.ktr
- Group by - include all rows and calculations .ktr.
Metadata Injection Support
All fields of this step support metadata injection. You can use this step with ETL metadata injection to pass metadata to your transformation at runtime.
The metadata injection values for the aggregation type are: