Book Image

Learning Cascading

Book Image

Learning Cascading

Overview of this book

Table of Contents (18 chapters)
Learning Cascading
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
7
Optimizing the Performance of a Cascading Application
Index

Creating and using subassemblies


Code reusability is the holy grail of software development. Cascading renders itself beautifully to this concept. In Cascading it is relatively simple to create basic building blocks out of pipe assemblies. These building blocks are known as pipe subassemblies, which you can organize into libraries. You then pick and choose these subassemblies to create your own custom "brewery."

Cascading also generously provides us with many built-in subassemblies described in the following sections.

Built-in subassemblies

These are the built-in subassemblies:

  • Coerce: cascading.pipe.assembly.Coerce. We briefly touched on coercing fields of one type into another type in Chapter 2, Cascading Basics in Detail. Cascading provides a built-in subassembly to do this. Using this subassembly, you can coerce fields of one type into another within a pipe assembly. For example, the following code will convert the String field timestamp into long:

    pipe = new Coerce(pipe, new Fields("timestamp...