July 30, 2023

tReservoirSampling – Docs for ESB 7.x

tReservoirSampling

Extracts a random sample data from a big data set.

tReservoirSampling extracts a
sample from the input data set in such a way that profiling results on the sample data are
uniform and homogeneous with the profiling results on the full data set.

In local mode, Apache Spark 2.0.0, 2.3.0 and 2.4.0 are supported.

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

tReservoirSampling Standard properties

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

The Standard
tReservoirSampling component belongs to the Data Quality family.

The component in this framework is available in Talend Data Management Platform, Talend Big Data Platform, Talend Real Time Big Data Platform, Talend Data Services Platform, Talend MDM Platform and in 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 Sync columns to retrieve the schema from
the previous component 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.

Sample Size

Set how many rows to sample from the input flow.

Advanced settings

Seed for random generator

Set a random number if you want to extract the same sample in different
executions of the Job.

Repeating the execution with a different value for the seed will result in a
different data samples being extracted.

Keep this field empty if you want to extract a different data sample each time
you execute the Job.

tStat
Catcher
Statistics

Select this check box to collect log data at the component
level.

Usage

Usage rule

This component helps you to test profiling analyses on a sample data and have
results similar to the results on the full data set.

tReservoirSampling can not
be used in Map/Reduce Jobs for the time being.

Extracting sample data from an input data set

This scenario applies only to Talend Data Management Platform, Talend Big Data Platform, Talend Real Time Big Data Platform, Talend Data Services Platform, Talend MDM Platform and Talend Data Fabric.

This scenario describes a basic Job that extracts sample data from an input flow.

Below is a capture of the input flow:

tReservoirSampling_1.png

To replicate the example described below, retrieve the
tReservoirSampling_scenario.zip file from the
Downloads tab of the online version of this page at https://help.talend.com.

Setting up the Job

  1. Drop the following components from the Palette onto
    the design workspace: tFileInputDelimited, tReservoirSampling and tFileOutputDelimited.

    tReservoirSampling_2.png

  2. Connect all the components together using the Row
    > Main link.

Configuring the input data

  1. Double-click tFileInputDelimited to display the
    Basic settings view and define the component
    properties.

    tReservoirSampling_3.png

  2. In the File name/Stream field, browse to the file
    to be used as the main input.

    This file provides some information about customers.
  3. Define the row and field separators and the header and footer in the corresponding
    fields, if any.
  4. Click the […] button next to Edit schema to open a dialog box and define the input schema.

    In this example, according to the input file structure, the schema is made of ten
    columns.
    tReservoirSampling_4.png

  5. Click the [+] button and define the input columns
    in the dialog box as in the above figure. Click OK to
    close the dialog box.
  6. If needed, right-click tFileInputDelimited and
    select Data Viewer to display a view of the input
    data.

Configuring the sample data

  1. Double-click tReservoirSampling to display the
    Basic settings view and define the component
    properties.

    tReservoirSampling_5.png

  2. Click the Edit schema button to view the input and
    output columns and do any modifications in the output schema, if needed.

    tReservoirSampling_6.png

  3. In the Sample Size field, enter a number for the
    rows you want to extract from the input flow, 24 in this example.
  4. Click the Advanced settings tab and enter a random
    number in the Seed for random generator field.

    By setting a number in this field, you will extract the same sample in each
    execution of the Job. Change the value if you want to extract a different sample.

Configuring the output component

  1. Double-click tFileOutputDelimited to display its
    Basic settings view and define the component
    properties.

    tReservoirSampling_7.png

  2. In the File Name field, specify the path to the
    file to which you want to write the sample data.
  3. Define the row and field separators in the corresponding fields, if any.

Executing the Job

  1. Save your Job and press F6 to execute it.

    The sample data is extracted and written to the output file.
  2. Right-click the output component and select Data
    Viewer
    to display the extracted data.

    tReservoirSampling_8.png

    24 records have been extracted from the input file as you defined in the tReservoirSampling component settings. The Code column indicates that data has not been extracted
    sequentially from the input file. Data has been extracted in a way that any profiling
    results on the sample data will be close to the profiling results on the full data
    set.

tReservoirSampling properties for Apache Spark Batch

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

The Spark Batch
tReservoirSampling component belongs to the Data Quality family.

The component in this framework is available in all Talend Platform products with Big Data and in 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 Sync columns to retrieve the schema from
the previous component 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.

Sample Size

Set how many rows to sample from the input flow.

Advanced settings

Seed for random generator

Set a random number if you want to extract the same sample in different executions
of the Job.

Repeating the execution with a different value for the seed will result in a
different data samples being extracted.

Keep this field empty if you want to extract a different data sample each time you
execute the Job.

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.


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