tAggregateSortedRow
output column is configured with many rows as required, the operations to be carried out and
the input column from which the data will be taken for better data aggregation.
tAggregateSortedRow Standard properties
These properties are used to configure tAggregateSortedRow running in the Standard Job framework.
The Standard
tAggregateSortedRow component belongs to the Processing family.
The component in this framework is available in all Talend
products.
Basic settings
Schema and Edit |
A schema is a row description, it defines the number of fields to Click Edit
Click Sync columns to retrieve This This |
 |
Built-in: The schema will be |
 |
Repository: The schema already |
Input rows count |
Specify the number of rows that are sent to the tAggregateSortedRow component. Note:
If you specified a Limit for |
Group by |
Define the aggregation sets, the values of which will be used for |
 |
Output Column: Select the column Ex: Select Country to calculate an average of values for each |
 |
Input Column: Match the input |
Operations |
Select the type of operation along with the value to use for the |
 |
Output Column: Select the |
 |
Function: Select the operator among:
|
 |
Input column: Select the input |
 |
Ignore null values: Select the |
Advanced settings
tStatCatcher Statistics |
Check this box to collect the log data at component level. |
Global Variables
Global Variables |
ERROR_MESSAGE: the error message generated by the
NB_LINE: the number of rows read by an input component or A Flow variable functions during the execution of a component while an After variable To fill up a field or expression with a variable, press Ctrl + For further information about variables, see |
Usage
Usage rule |
This component handles flow of data therefore it requires input |
Sorting and aggregating the input data
This scenario describes a Job that sorts the entries of the input data based on two
columns and displays the sorted data on the console, then aggregates the sorted data based
on one column and displays the aggregated data on the console.
Adding and linking components
-
Create a new Job and add the following components by typing their names in the
design workspace or dropping them from the Palette: a tFixedFlowInput
component, a tSortRow component, a tAggregateSortedRow component, and two tLogRow components. -
Link tFixedFlowInput to tSortRow using a Row >
Main connection. -
Do the same to link tSortRow to the first
tLogRow, link the first tLogRow to tAggregateSortedRow, and link tAggregateSortedRow to the second tLogRow.
Configuring the components
Sorting the input data
-
Double-click tFixedFlowInput to open its
Basic settings view. -
Click the […] button next to Edit schema and in the pop-up window define the
schema by adding four columns: Id and
Age of Integer type, and Name and Team of
String type.Click OK to close the schema editor and
accept the propagation prompted by the pop-up dialog box. -
In the Mode area, select Use Inline Content(delimited file), and then in the
Content field displayed, enter the input
data to be sorted and aggregated. In this example, the input data is as
follows:123456781;Thomas;28;Component Team2;Harry;32;Doc Team3;John;26;Component Team4;Nicolas;27;QA Team5;George;24;Component Team6;Peter;30;Doc Team7;Teddy;23;QA Team8;James;26;Component Team -
Double-click tSortRow to open its Basic settings view.
-
Click the [+] button below the Criteria table to add as many rows as required and
then specify the sorting criteria in the table. In this example, two rows are
added, and the input entries will be sorted based on the column Team and then the column Age, both in ascending order. -
Double-click the first tLogRow to open its
Basic settings view. -
In the Mode area, select Table (print values in cells of a table) for better
readability of the sorting result.
Aggregating the sorted data
-
Double-click tAggregateSortedRow to open its
Basic settings view. -
Click the […] button next to Edit schema and in the pop-up window define the
schema by adding five columns: AggTeam of
String type, AggCount, MinAge, MaxAge,
and AvgAge of Integer type.Click OK to close the schema editor and
accept the propagation prompted by the pop-up dialog box. -
In the Input rows count field, enter the
exact number of rows of the input data. In this example, it is 8. -
Click the [+] button below the Group by table to add as many rows as required and
specify the aggregation set in the table. In this example, the data will be
aggregated based on the input column Team. -
Click the [+] button below the Operations table to add as many rows as required and
specify the operation to be carried out and the corresponding input column from
which the data will be taken for each output column. In this example, we want to
calculate the number of the input entries, the minimum age, the maximum age, and
the average age for each team. -
Double-click the second tLogRow to open its
Basic settings view. -
In the Mode area, select Table (print values in cells of a table) for better
readability of the sorting result.
Saving and executing the Job
- Press Ctrl + S to save the Job.
-
Execute the Job by pressing F6 or clicking
Run on the Run tab.As shown above, the input entries are sorted based on the column Team and then the column Age, both in ascending order, and the sorted entries are then
aggregated based on the column Team.