Tutorial: Transforming input data
For this tutorial, we’ll assume you’ve already downloaded Apache Druid as described in the single-machine quickstart and have it running on your local machine.
It will also be helpful to have finished and Tutorial: Querying data.
We will ingest the sample data using the following spec, which demonstrates the use of transform specs:
In the transform spec, we have two expression transforms:
super-animal
: prepends “super-“ to the values in theanimal
column. This will override theanimal
column with the transformed version, since the transform’s name isanimal
.- : multiplies the
number
column by 3. This will create a newtriple-number
column. Note that we are ingesting both the original and the transformed column.
triple-number
values that match 300- values that match 3
This filter selects the first 3 rows, and it will exclude the final “lion” row in the input data. Note that the filter is applied after the transformation.
Let’s submit this task now, which has been included at quickstart/tutorial/transform-index.json
:
The “lion” row has been discarded, the animal
column has been transformed, and we have both the original and transformed column.