Scenario: Sorting data in ascending order - 6.1

Talend Components Reference Guide

EnrichVersion
6.1
EnrichProdName
Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for Big Data
Talend Open Studio for Data Integration
Talend Open Studio for Data Quality
Talend Open Studio for ESB
Talend Open Studio for MDM
Talend Real-Time Big Data Platform
task
Data Governance
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio

This scenario describes a three-component Job that sorts rows of data based on one or more sorting conditions and stores the result into a local file.

Setting up the Job

  1. Drop the following components from the Palette to the design workspace: tPigSort, tPigLoad, tPigStoreResult.

  2. Connect tPigLoad to tPigFilterRow using a Row > Pig Combine connection.

  3. Connect tPigFilterRow to tPigStoreResult using a Row > Pig Combine connection.

Loading the data

  1. Double-click tPigLoad to open its Basic settings view.

  2. Click the [...] button next to Edit schema to add columns for tPigLoad.

  3. Click the [+] button to add Name, Country and Age and click OK to save the setting.

  4. Select Local from the Mode area.

  5. Fill in the Input filename field with the full path to the input file.

    In this scenario, the input file is CustomerList that contains rows of names, country names and age.

  6. Select PigStorage from the Load function list.

  7. Leave rest of the settings as they are.

Setting the sorting condition

  1. Double-click tPigSort to open its Basic settings view.

  2. Click Sync columns to retrieve the schema structure from the preceding component.

  3. Click the [+] button beneath the Sort key table to add a new sort key. Select Age from the Column list and select ASC from the Order list.

    This sort key will sort the data in CustomerList in ascending order based on Age.

Saving the data to a local file

  1. Double-click tPigStoreResult to open its Basic settings view.

  2. Click Sync columns to retrieve the schema structure from the preceding component.

  3. Select Remove result directory if exists.

  4. Fill in the Result file field with the full path to the result file.

    In this scenario, the result of filter is saved in Lucky_Customer file.

  5. Select PigStorage from the Store function list.

  6. Leave rest of the settings as they are.

Executing the Job

Save your Job and press F6 to run it.

The Lucky_Customer file is generated containing the data in ascending order based on Age.