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 books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.