Aggregating the average price of customer purchases - Cloud

Talend Cloud Pipeline Designer Processors Guide

author
Talend Documentation Team
EnrichVersion
Cloud
EnrichProdName
Talend Cloud
task
Design and Development > Designing Pipelines
EnrichPlatform
Talend Pipeline Designer

Before you begin

  • You have previously created a connection to the system storing your source data.

  • You have previously added the dataset holding your source data.

    Here, a hierarchical list of customers data including ID, product information such as book title and price, etc that you can find attached to this document (download the aggregate-customers.json file from the Downloads tab in the left panel of this page).

  • You also have created the connection and the related dataset that will hold the processed data.

    Here, a file stored on HDFS.

Procedure

  1. Click ADD PIPELINE on the PIPELINES page. Your new pipeline opens.
  2. Give the pipeline a meaningful name.
    Aggregate Average Purchase Price
  3. Click ADD SOURCE to open the panel allowing you to select your source data, here a list of hierarchical customer data about book purchases.
  4. Select your dataset and click SELECT DATASET in order to add it to the pipeline.
    Rename it if needed.
  5. Click and add an Aggregate processor to the pipeline. The configuration panel opens.
  6. Give a meaningful name to the processor.
    calculate average price
  7. In the GROUP BY area, click the recycle bin icon next to the empty field to remove it as you want the whole dataset to be aggregated into one single record.
  8. In the OPERATIONS area:
    1. Select .product.price in the Field list and Average in the Operation list as you want to group the average price of all the books purchased by customers.
    2. Name the generated field (Output field), avgPrice for example.
  9. Click SAVE to save your configuration.
  10. Click the ADD DESTINATION item on the pipeline to open the panel allowing to select the dataset that will hold your output data (HDFS).
    Rename it if needed.
  11. (Optional) Click the preview icon after the Aggregate processor to preview the calculated data after the aggregating operation: the average book price is 13.96 dollars.
  12. On the top toolbar of Talend Cloud Pipeline Designer, select your Run Profile in the list (for more information, see Execution profiles).
  13. Click the run icon to run your pipeline.

Results

Your pipeline is being executed, the average book price is aggregated in one single record, and the output flow is sent to the target systems you have indicated.