Book Image

Programming MapReduce with Scalding

By : Antonios Chalkiopoulos
Book Image

Programming MapReduce with Scalding

By: Antonios Chalkiopoulos

Overview of this book

Table of Contents (16 chapters)
Programming MapReduce with Scalding
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Typed API


Scalding offers another type-safe API. The type-safe API is not named. Data streams through the typed pipe as tuples, and reference to data is achieved through the notation tuple._1 or by using the case classes, as shown in the following code:

case class Animal(name : String, kind: String)
val animals : TypedPipe[Animal] = getAnimals
val birds = animals.filter { _.kind == "bird" }

Operations that exist in both APIs and pipes interoperate. We can convert from Fields to Typed and the other way round. Using any one of the APIs is a matter of preference and code readability.