Creating data preprocessing pipelines

In this section, we will convert some of the data processing functions from the previous sections into custom Transformers. These Transformer objects map an input DataFrame to an output DataFrame and are typically used to prepare DataFrames for machine learning applications.

We create the following classes as UnaryTransformer objects that apply transformations to one input DataFrame column and produce another by appending a new column (containing the processing results of the applied function) to it. These custom Transformer objects can then be a part of a processing pipeline.

First, we create the four custom UnaryTransformer classes that we will use in our example, as follows:

TablesNHTMLElemCleaner.scala ...

Get Learning Spark SQL now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.