Book Image

Hadoop MapReduce v2 Cookbook - Second Edition: RAW

Book Image

Hadoop MapReduce v2 Cookbook - Second Edition: RAW

Overview of this book

Table of Contents (19 chapters)
Hadoop MapReduce v2 Cookbook Second Edition
Credits
About the Author
Acknowledgments
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

HCatalog – writing data to Hive tables from Java MapReduce computations


HCatalog also allows us to write data to Hive tables from Java MapReduce computations using the HCatOutputFormat. In this recipe, we'll be looking at how to write data to a Hive table using a Java MapReduce computation. This recipe extends the computation of the previous HCatalog – performing Java MapReduce computations on data mapped to Hive tables recipe by adding table write capability.

Getting ready

Make sure HCatalog is installed with Hive in your system.

How to do it...

This section demonstrates how to write data to a Hive table using a MapReduce computation. Perform the following steps:

  1. Follow the Hive batch mode – using a query file recipe of this chapter to create and populate the user Hive table that we'll be using in this recipe.

  2. Compile the sample source code for this chapter by running the following gradle command from the chapter6 folder of the source repository:

    $ gradle clean build uberjar
    
  3. Use Hive CLI to create...