# Hello World

{% hint style="warning" %}

#### Workshop - Hello World

Build a minimal transformation in Spoon. Use steps, hops, and notes. Preview data and review execution metrics.

**What you’ll do**

* Create a transformation
* Add and configure **Generate Rows** and **Dummy**
* Connect steps with hops
* Add a note to document the flow
* Preview data from a step
* Run the transformation and review results

**Prerequisites:** Pentaho Data Integration installed and configured

**Estimated time:** 10 minutes
{% endhint %}

{% embed url="<https://www.loom.com/share/cb9fa033ddcf46c6b7d17c532c16ac66?hideEmbedTopBar=true&hide_owner=true&hide_share=true&hide_title=true>" %}
What is a Transformation?
{% endembed %}

***

{% hint style="info" %}
**Create a new transformation**

Use any of these options to open a new transformation tab:

* Select **File** > **New** > **Transformation**
* Use `Ctrl+N` (Windows/Linux) or `Cmd+N` (macOS)
  {% endhint %}

<figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-084fd579269b0cfeb95241c505ba6e67962e8f21%2Fhello%20world.tr.png?alt=media" alt="" width="375"><figcaption><p>hello world.tr</p></figcaption></figure>

{% file src="<https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2FvbNhfByjuU5ihEZNULmt%2Ftr_hello_world.ktr?alt=media&token=66fb6fed-d009-49d1-9c61-0c06d7f98a50>" %}

{% tabs %}
{% tab title="1. Generate Rows" %}
{% hint style="info" %}

#### **Generate Rows**

Generate Rows outputs a specified number of rows. By default, the rows are empty. You can also generate static fields for test data. For example, generate 12 rows for 12 months.

Generate Rows is also useful as a single-row “starter” step.
{% endhint %}

1. Start Pentaho Data Integration (Spoon).

{% hint style="info" %}
{% tabs %}
{% tab title="Windows (PowerShell)" %}

```powershell
Set-Location C:\Pentaho\design-tools\data-integration
.\spoon.bat
```

{% endtab %}

{% tab title="macOS / Linux" %}

```bash
cd ~/Pentaho/design-tools/data-integration
./spoon.sh
```

{% endtab %}
{% endtabs %}
{% endhint %}

2. In the **Design** tab, expand the `Input` category.
3. Drag **Generate Rows** onto the canvas.

{% hint style="info" %}
Tip: You can also search for `Generate Rows`.
{% endhint %}

<div align="center"><figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-3e752f71f8ae2d9f9f9450573af65e0e404f79c5%2Fgen%20rows.png?alt=media" alt="" width="563"><figcaption><p>Generate rows</p></figcaption></figure></div>

4. Double-click **Generate Rows** to open the step properties.

<figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-cf1da402da24a4bd6965cf2a17442ba5c75e861c%2Fhello%20world.png?alt=media" alt="" width="563"><figcaption><p>Generate rows - settings</p></figcaption></figure>

Ensure the following details are configured:

| **Step name** | gr\_hello-world |
| ------------- | --------------- |
| **Limit**     | 10              |
| **Name**      | message         |
| **Type**      | string          |
| **Value**     | hello world     |

{% hint style="info" %}
Before you close the dialog, preview the data.
{% endhint %}

5. Select **Preview**. The **Enter preview size** dialog opens.

<figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-2a3ab5ead0069b97bb18d8f2677392aecf3ba5cd%2Fpreview%20(1).png?alt=media" alt="" width="375"><figcaption><p>Preview rows</p></figcaption></figure>

6. In **Enter preview size**, select **OK**.
7. Verify the 10 rows. Then select **OK** to close the preview dialog.
8. Select **OK** to close the **Generate Rows** dialog.
   {% endtab %}

{% tab title="2. Dummy" %}
{% hint style="info" %}

#### **Dummy**

The Dummy step does not process records. Use it as a placeholder during development. It is handy when you need a second step to connect.
{% endhint %}

1. In the **Design** tab, expand the `Flow` category.
2. Drag **Dummy** onto the canvas.

<div align="center"><figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-1c8a29ab8b4b07b173a9b5bbf0eb7047720ec5b4%2Fdummy.png?alt=media" alt="" width="375"><figcaption><p>dummy step</p></figcaption></figure></div>
{% endtab %}

{% tab title="3. Hops, Annotations, etc" %}
{% hint style="info" %}

#### **Hops**

Hops define row flow between steps. PDI buffers rows between steps as the transformation runs.
{% endhint %}

1. Select the `gr_hello-world` step.
2. Hold down the Shift key.
3. Drag and drop the hop onto the Dummy step.
4. Release the Shift key.

***

**Add a note**

1. Right-click anywhere on the Spoon canvas.
2. Select **New note**.

<div align="left"><figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-87dfae23d9f8c39c60c8a274381184107a5c375d%2Fnote.png?alt=media" alt=""><figcaption><p>Notes</p></figcaption></figure> <figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-277ca05bc34664ee109a6d9285b3746658f22278%2Fnote2.png?alt=media" alt=""><figcaption><p>Notes - Style</p></figcaption></figure></div>

***

**Transformation properties**

To view the transformation properties:

1. Double-click anywhere on the canvas.

<div align="center"><figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-49dabe66a0efafc98d8154e679f6e7698a91afde%2Fproperties.png?alt=media" alt="" width="563"><figcaption><p>transformation properties</p></figcaption></figure></div>

{% hint style="info" %}
Tip: Add details in **Extended description**.
{% endhint %}
{% endtab %}

{% tab title="4. Run" %}
{% hint style="info" %}

#### Run the transformation

Run the transformation locally.
{% endhint %}

1. In Spoon, select **Action** > **Run this transformation**.

{% hint style="info" %}
You can also select **Run** in the toolbar.

The **Execute a transformation** window opens. For this workshop, keep **Local** execution.
{% endhint %}

2. In the run dialog, open **Run options**.

<div align="center"><figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-5dfd98fcd8fb00a90f591cd110ef1e310e131ac4%2Frun.png?alt=media" alt="" width="375"><figcaption><p>Run Options</p></figcaption></figure></div>

{% hint style="info" %}
In the Run Options panel you can set:

* **Run configuration** (local, remote, or cluster)
* **Log level**
* **Automatically save** the transformation
  {% endhint %}

<div align="center"><figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-69357569f2154216241f17635660c830fd91efff%2Fsave%20transformations.png?alt=media" alt="" width="375"><figcaption><p>Automatically save transformation</p></figcaption></figure></div>

The transformation executes.

<figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-f204f68ce3858fd917e589e32771440bfa892ce7%2Fex%20trans.png?alt=media" alt="" width="375"><figcaption><p>Green ticks indicate successful execution</p></figcaption></figure>

{% hint style="warning" %}
A green tick confirms the transformation's execution, but doesn't guarantee the success of the underlying operations.
{% endhint %}

***

{% hint style="info" %}
**Execution Results**

The Execution Results section of the window contains several different tabs that help you to see how the transformation executed, pinpoint errors, and monitor performance.
{% endhint %}

<div align="center"><figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-5cc0332648d0c7e74dc0bf5567e7fbd503009a6b%2Ftr%20metrics.png?alt=media" alt=""><figcaption><p>Logging</p></figcaption></figure></div>

Logging tab displays logging information for each of the steps in the transformation.

<figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-ce63a94d556ee973dbf174b60dbcebf979a627e3%2Fstep%20metrics.png?alt=media" alt=""><figcaption><p>Step Metrics</p></figcaption></figure>

{% hint style="info" %}
Step Metrics tab provides statistics for each step in your transformation including how many records were read, written, caused an error, processing speed (rows per second) and more. This tab also indicates whether an error occurred in a transformation step.
{% endhint %}

<figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-85d36d67e82f84f173499633cc87f30fcdfc6fe3%2Fmetrics.png?alt=media" alt=""><figcaption><p>Metrics</p></figcaption></figure>

{% hint style="info" %}
Metrics can help identify bottlenecks (back pressure). In this example, the transformation took 30 ms. Notice `gr_hello-world` and `Dummy` initialize at the same time. Steps run in parallel in separate threads.
{% endhint %}

<figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-d6664760a7e4d3dc6e5a02d2a084f5ae4851d005%2Frun%20preview.png?alt=media" alt=""><figcaption><p>Preview data</p></figcaption></figure>

{% hint style="info" %}
Preview tab displays the records.
{% endhint %}

***

{% hint style="info" %}
**Viewing the Transformation structure**

Select the **View** icon (upper-left). The tree switches to the structure of the transformation.
{% endhint %}

<div align="center"><figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-ba6e44bd6bf16a4c5b8b419145af3de8e03bcede%2Fview.png?alt=media" alt=""><figcaption><p>View</p></figcaption></figure></div>
{% endtab %}
{% endtabs %}

***
