July 30, 2023

tSortRow – Docs for ESB 7.x

tSortRow

Helps creating metrics and
classification table.

tSortRow sorts input data based on one or several
columns, by sort type and order.

Depending on the Talend
product you are using, this component can be used in one, some or all of the following
Job frameworks:

tSortRow Standard properties

These properties are used to configure tSortRow running in the Standard Job framework.

The Standard
tSortRow component belongs to the Processing family.

The component in this framework is available in all Talend
products
.

Basic settings

Schema and Edit
Schema

A schema is a row description. It defines the number of fields
(columns) to be processed and passed on to the next component. When you create a Spark
Job, avoid the reserved word line when naming the
fields.

Click Edit
schema
to make changes to the schema. If the current schema is of the Repository type, three options are available:

  • View schema: choose this
    option to view the schema only.

  • Change to built-in property:
    choose this option to change the schema to Built-in for local changes.

  • Update repository connection:
    choose this option to change the schema stored in the repository and decide whether
    to propagate the changes to all the Jobs upon completion. If you just want to
    propagate the changes to the current Job, you can select No upon completion and choose this schema metadata
    again in the Repository Content
    window.

Click Sync columns to retrieve
the schema from the previous component connected in the Job.

This
component offers the advantage of the dynamic schema feature. This allows you to
retrieve unknown columns from source files or to copy batches of columns from a source
without mapping each column individually. For further information about dynamic schemas,
see
Talend Studio

User Guide.

This
dynamic schema feature is designed for the purpose of retrieving unknown columns of a
table and is recommended to be used for this purpose only; it is not recommended for the
use of creating tables.

 

Built-In: You create and store the schema locally for this component
only.

 

Repository: You have already created the schema and stored it in the
Repository. You can reuse it in various projects and Job designs.

Criteria

Click + to add as many lines as required for the sort to be
complete. By default the first column defined in your schema is
selected.

 

Schema column: Select the column
label from your schema, which the sort will be based on. Note that
the order is essential as it determines the sorting priority.

 

Sort type: Numerical and
Alphabetical order are proposed. More sorting types to come.

 

Order: Ascending or descending
order.

Advanced settings

Sort on disk

Customize the memory used to temporarily store output data.

Temp data directory path: Set the
location where the temporary files should be stored.

Create temp data directory if not
exists
: Select this check box to create the directory
if it does not exist.

Buffer size of external sort: Type
in the size of physical memory you want to allocate to sort
processing.

tStatCatcher Statistics

Select this check box to gather the Job processing metadata at the Job level as well as
at each component level.

Global Variables

Global Variables

ERROR_MESSAGE: the error message generated by the
component when an error occurs. This is an After variable and it returns a string. This
variable functions only if the Die on error check box is
cleared, if the component has this check box.

A Flow variable functions during the execution of a component while an After variable
functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl +
Space
to access the variable list and choose the variable to use from it.

For further information about variables, see
Talend Studio

User Guide.

Usage

Usage rule

This component handles flow of data therefore it requires input
and output, hence is defined as an intermediary step.

Sorting entries

This scenario describes a three-component Job. A tRowGenerator is used to create random entries which are directly sent
to a tSortRow to be ordered following a defined value
entry. In this scenario, we suppose the input flow contains names of salespersons along
with their respective sales and their years of presence in the company. The result of
the sorting operation is displayed on the Run
console.

tSortRow_1.png
  • Drop the three components required for this use case: tRowGenerator, tSortRow and
    tLogRow from the Palette to the design workspace.

  • Connect them together using Row
    main links.

  • On the tRowGenerator editor, define the
    values to be randomly used in the Sort component. For more information regarding
    the use of this particular component, see tRowGenerator

tSortRow_2.png
  • In this scenario, we want to rank each salesperson according to its
    Sales value and to its number of years in the
    company.

  • Double-click tSortRow to display the
    Basic settings tab panel. Set the sort
    priority on the Sales value and as secondary criteria, set the number of years
    in the company.

tSortRow_3.png
  • Use the plus button to add the number of rows required. Set the type of
    sorting, in this case, both criteria being integer, the sort is numerical. At
    last, given that the output wanted is a rank classification, set the order as
    descending.

  • Display the Advanced Settings tab and select
    the Sort on disk check box to modify the
    temporary memory parameters. In the Temp data directory
    path
    field, type the path to the directory where you want to
    store the temporary data. In the Buffer size of external
    sort
    field, set the maximum buffer value you want to allocate to
    the processing.

Warning:

The default buffer value is 1000000 but the more rows and/or columns you
process, the higher the value needs to be to prevent the Job from automatically
stopping. In that event, an “out of memory” error message displays.

  • Make sure you connected this flow to the output component, tLogRow, to display the result in the Job
    console.

  • Press F6 to run the Job. The ranking is based
    first on the Sales value and then on the number of years of experience.

tSortRow_4.png

Sorting entries based on dynamic schema

This scenario applies only to subscription-based Talend products.

In this scenario we will sort entries in an input file based on a dynamic schema,
display the sorting result on the Run console, and save
the sorting result in an output file. For more information about the dynamic schema
feature, see
Talend Studio User
Guide
.

tSortRow_5.png
  • Drop the components required for this use case: tFileInputDelimited, tSortRow,
    tLogRow and tFileOutputDelimited from the Palette to the design workspace.

  • Connect these components together using Row
    > Main links.

  • Double-click the tFileInputDelimited
    component to display its Basic settings view.

tSortRow_6.png
Warning:

The dynamic schema feature is only supported in Built-In mode and requires the input file to have a
header row.

  • Select Built-In from the Property Type list.

  • Click the […] button next to the File Name field to browse to your input file. In this
    use case, the input file cars.csv has five columns:
    ID_Owner, Registration,
    Make, Color, and
    ID_Reseller.

  • Specify the header row in Header field. In
    this use case the first row is the header row.

  • Select Built-In from the Schema list, and click Edit
    schema
    to set the input schema.

tSortRow_7.png
Warning:

The dynamic column must be defined in the last row of the
schema.

  • In the schema editor, add two columns and name them
    ID_Owner and Other respectively.
    Set the data type of the Other column to Dynamic to retrieve all the columns undefined in the
    schema.

  • Click OK to propagate the schema and close
    the schema editor.

  • Double-click tSortRow to display the
    Basic settings view.

tSortRow_8.png
  • Add a row in the Criteria table by clicking
    the plus button, select Other under Schema column, select alpha as the sorting
    type, and select the ascending or
    descending order for data output.

Warning:

Dynamic column sorting works only when the sorting type is
set to alpha.

  • To view the output in the form of a table on the Run console, double-click the tLogRow component and select the Table option in the Basic
    settings
    view.

  • Double-click the tFileOutputDelimited
    component to display its Basic Settings
    view.

tSortRow_9.png
  • Click the […] button next to the File Name field to browse to the directory where you
    want to save the output file, and then enter a name for the file.

  • Select the Include Header check box to
    retrieve the column names as well as the sorted data.

  • Save your Job and press F6 to run it.

    The sorting result is displayed on the Run
    console and written into the output file.

tSortRow_10.png

tSortRow MapReduce properties (deprecated)

These properties are used to configure tSortRow running in the MapReduce Job framework.

The MapReduce
tSortRow component belongs to the Processing family.

The component in this framework is available in all subscription-based Talend products with Big Data
and Talend Data Fabric.

The MapReduce framework is deprecated from Talend 7.3 onwards. Use Talend Jobs for Apache Spark to accomplish your integration tasks.

Basic settings

Schema and Edit
Schema

A schema is a row description. It defines the number of fields
(columns) to be processed and passed on to the next component. When you create a Spark
Job, avoid the reserved word line when naming the
fields.

Click Edit
schema
to make changes to the schema. If the current schema is of the Repository type, three options are available:

  • View schema: choose this
    option to view the schema only.

  • Change to built-in property:
    choose this option to change the schema to Built-in for local changes.

  • Update repository connection:
    choose this option to change the schema stored in the repository and decide whether
    to propagate the changes to all the Jobs upon completion. If you just want to
    propagate the changes to the current Job, you can select No upon completion and choose this schema metadata
    again in the Repository Content
    window.

Click Sync columns to retrieve
the schema from the previous component connected in the Job.

 

Built-In: You create and store the schema locally for this component
only.

 

Repository: You have already created the schema and stored it in the
Repository. You can reuse it in various projects and Job designs.

Criteria

Click + to add as many lines as required for the sort to be
complete. By default the first column defined in your schema is
selected.

 

Schema column: Select the column
label from your schema, which the sort will be based on. Note that
the order is essential as it determines the sorting priority.

 

Sort type: Numerical and
Alphabetical order are proposed. More sorting types to come.

 

Order: Ascending or descending
order.

Global Variables

Global Variables

ERROR_MESSAGE: the error message generated by the
component when an error occurs. This is an After variable and it returns a string. This
variable functions only if the Die on error check box is
cleared, if the component has this check box.

A Flow variable functions during the execution of a component while an After variable
functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl +
Space
to access the variable list and choose the variable to use from it.

For further information about variables, see
Talend Studio

User Guide.

Usage

Usage rule

In a
Talend
Map/Reduce Job, this component is used as an intermediate
step and other components used along with it must be Map/Reduce components, too. They
generate native Map/Reduce code that can be executed directly in Hadoop.

For further information about a
Talend
Map/Reduce Job, see the sections
describing how to create, convert and configure a
Talend
Map/Reduce Job of the

Talend Open Studio for Big Data Getting Started Guide
.

For a scenario demonstrate a Map/Reduce Job using this component,
see Deduplicating entries using Map/Reduce components.

Note that in this documentation, unless otherwise
explicitly stated, a scenario presents only Standard Jobs,
that is to say traditional
Talend
data integration Jobs, and non Map/Reduce Jobs.

Related scenarios

No scenario is available for the Map/Reduce version of this component yet.

tSortRow properties for Apache Spark Batch

These properties are used to configure tSortRow running in the Spark Batch Job framework.

The Spark Batch
tSortRow component belongs to the Processing family.

The component in this framework is available in all subscription-based Talend products with Big Data
and Talend Data Fabric.

Basic settings

Schema and Edit
Schema

A schema is a row description. It defines the number of fields
(columns) to be processed and passed on to the next component. When you create a Spark
Job, avoid the reserved word line when naming the
fields.

Click Edit
schema
to make changes to the schema. If the current schema is of the Repository type, three options are available:

  • View schema: choose this
    option to view the schema only.

  • Change to built-in property:
    choose this option to change the schema to Built-in for local changes.

  • Update repository connection:
    choose this option to change the schema stored in the repository and decide whether
    to propagate the changes to all the Jobs upon completion. If you just want to
    propagate the changes to the current Job, you can select No upon completion and choose this schema metadata
    again in the Repository Content
    window.

Click Sync columns to retrieve
the schema from the previous component connected in the Job.

 

Built-In: You create and store the schema locally for this component
only.

 

Repository: You have already created the schema and stored it in the
Repository. You can reuse it in various projects and Job designs.

Criteria

Click + to add as many lines as required for the sort to be
complete. By default the first column defined in your schema is
selected.

 

Schema column: Select the column
label from your schema, which the sort will be based on. Note that
the order is essential as it determines the sorting priority.

 

Sort type: Numerical and
Alphabetical order are proposed. More sorting types to come.

 

Order: Ascending or descending
order.

Usage

Usage rule

This component is used as an intermediate step.

This component, along with the Spark Batch component Palette it belongs to,
appears only when you are creating a Spark Batch Job.

Note that in this documentation, unless otherwise explicitly stated, a
scenario presents only Standard Jobs, that is to
say traditional
Talend
data integration Jobs.

Spark Connection

In the Spark
Configuration
tab in the Run
view, define the connection to a given Spark cluster for the whole Job. In
addition, since the Job expects its dependent jar files for execution, you must
specify the directory in the file system to which these jar files are
transferred so that Spark can access these files:

  • Yarn mode (Yarn client or Yarn cluster):

    • When using Google Dataproc, specify a bucket in the
      Google Storage staging bucket
      field in the Spark configuration
      tab.

    • When using HDInsight, specify the blob to be used for Job
      deployment in the Windows Azure Storage
      configuration
      area in the Spark
      configuration
      tab.

    • When using Altus, specify the S3 bucket or the Azure
      Data Lake Storage for Job deployment in the Spark
      configuration
      tab.
    • When using Qubole, add a
      tS3Configuration to your Job to write
      your actual business data in the S3 system with Qubole. Without
      tS3Configuration, this business data is
      written in the Qubole HDFS system and destroyed once you shut
      down your cluster.
    • When using on-premise
      distributions, use the configuration component corresponding
      to the file system your cluster is using. Typically, this
      system is HDFS and so use tHDFSConfiguration.

  • Standalone mode: use the
    configuration component corresponding to the file system your cluster is
    using, such as tHDFSConfiguration or
    tS3Configuration.

    If you are using Databricks without any configuration component present
    in your Job, your business data is written directly in DBFS (Databricks
    Filesystem).

This connection is effective on a per-Job basis.

Related scenarios

No scenario is available for the Spark Batch version of this component
yet.

tSortRow properties for Apache Spark Streaming

These properties are used to configure tSortRow running in the Spark Streaming Job framework.

The Spark Streaming
tSortRow component belongs to the Processing family.

This component is available in Talend Real Time Big Data Platform and Talend Data Fabric.

Basic settings

Schema and Edit
Schema

A schema is a row description. It defines the number of fields
(columns) to be processed and passed on to the next component. When you create a Spark
Job, avoid the reserved word line when naming the
fields.

Click Edit
schema
to make changes to the schema. If the current schema is of the Repository type, three options are available:

  • View schema: choose this
    option to view the schema only.

  • Change to built-in property:
    choose this option to change the schema to Built-in for local changes.

  • Update repository connection:
    choose this option to change the schema stored in the repository and decide whether
    to propagate the changes to all the Jobs upon completion. If you just want to
    propagate the changes to the current Job, you can select No upon completion and choose this schema metadata
    again in the Repository Content
    window.

Click Sync columns to retrieve
the schema from the previous component connected in the Job.

 

Built-In: You create and store the schema locally for this component
only.

 

Repository: You have already created the schema and stored it in the
Repository. You can reuse it in various projects and Job designs.

Criteria

Click + to add as many lines as required for the sort to be
complete. By default the first column defined in your schema is
selected.

 

Schema column: Select the column
label from your schema, which the sort will be based on. Note that
the order is essential as it determines the sorting priority.

 

Sort type: Numerical and
Alphabetical order are proposed. More sorting types to come.

 

Order: Ascending or descending
order.

Usage

Usage rule

This component is used as an intermediate step.

This component, along with the Spark Streaming component Palette it belongs to, appears
only when you are creating a Spark Streaming Job.

Note that in this documentation, unless otherwise explicitly stated, a scenario presents
only Standard Jobs, that is to say traditional
Talend
data
integration Jobs.

Spark Connection

In the Spark
Configuration
tab in the Run
view, define the connection to a given Spark cluster for the whole Job. In
addition, since the Job expects its dependent jar files for execution, you must
specify the directory in the file system to which these jar files are
transferred so that Spark can access these files:

  • Yarn mode (Yarn client or Yarn cluster):

    • When using Google Dataproc, specify a bucket in the
      Google Storage staging bucket
      field in the Spark configuration
      tab.

    • When using HDInsight, specify the blob to be used for Job
      deployment in the Windows Azure Storage
      configuration
      area in the Spark
      configuration
      tab.

    • When using Altus, specify the S3 bucket or the Azure
      Data Lake Storage for Job deployment in the Spark
      configuration
      tab.
    • When using Qubole, add a
      tS3Configuration to your Job to write
      your actual business data in the S3 system with Qubole. Without
      tS3Configuration, this business data is
      written in the Qubole HDFS system and destroyed once you shut
      down your cluster.
    • When using on-premise
      distributions, use the configuration component corresponding
      to the file system your cluster is using. Typically, this
      system is HDFS and so use tHDFSConfiguration.

  • Standalone mode: use the
    configuration component corresponding to the file system your cluster is
    using, such as tHDFSConfiguration or
    tS3Configuration.

    If you are using Databricks without any configuration component present
    in your Job, your business data is written directly in DBFS (Databricks
    Filesystem).

This connection is effective on a per-Job basis.

Related scenarios

No scenario is available for the Spark Streaming version of this component
yet.


Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x