Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Apache Hive Cookbook

You're reading from   Apache Hive Cookbook

Arrow left icon
Product type Paperback
Published in Apr 2016
Publisher Packt
ISBN-13 9781782161080
Length 268 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (14) Chapters Close

Preface 1. Developing Hive FREE CHAPTER 2. Services in Hive 3. Understanding the Hive Data Model 4. Hive Data Definition Language 5. Hive Data Manipulation Language 6. Hive Extensibility Features 7. Joins and Join Optimization 8. Statistics in Hive 9. Functions in Hive 10. Hive Tuning 11. Hive Security 12. Hive Integration with Other Frameworks Index

Compiling Hive from source

In this recipe, we will see how to compile Hive from source.

Getting ready

Apache Hive is an open source framework available for compilation and modification by any user. Hive source code is a maven project. The source has intermittent scripts executed on a UNIX platform during compilation.

The following prerequisites need to be installed:

  • UNIX OS: UNIX is preferable for Hive source compilation. Although the source could also be compiled on Windows, you need to comment out the intermittent scripts execution.
  • Maven: The following are the steps to configure maven:
    1. Download the Apache maven binaries for Linux (.tar.gz) from https://maven.apache.org/download.cgi.
      wget http://mirror.olnevhost.net/pub/apache/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz
      
    2. Extract the tar file:
      tar -xzvf apache-maven-3.3.3-bin.tar.gz
      
    3. Create a folder and move maven binaries to that folder:
      sudo mkdir –p /usr/lib/maven
      mv apache-maven-3.3.3-bin/usr/lib/maven/
      
    4. Open /etc/environment:
      sudo nano /etc/profile
      
    5. Add the following variable for the environment PATH:
      export M2_HOME=/usr/lib/maven/apache-maven-3.3.3-bin
      export M2=$M2_HOME/bin
      export PATH=$M2:$PATH
      
    6. Use the command source /etc/environment to add variables to PATH without restart:
      source /etc/environment
      
    7. Check whether maven is properly installed or not:
      mvn –version
      

How to do it...

Follow these steps to compile Hive on a Unix OS:

  1. Download the latest version of the Hive source tar file:
    sudo wget http://a.mbbsindia.com/hive/hive-1.2.1/apache-hive-1.2.1-src.tar.gz
    
  2. Extract the source folder:
    tar –xzvf apache-hive-1.2.1-src.tar.gz
    
  3. Move to the Hive directory:
    cd apache-hive-1.2.1-src
    
  4. To import Hive packages in eclipse, run the following command:
    mvn eclipse:eclipse
    
  5. To compile Hive with Hadoop 2 binaries, run the following command:
    mvn clean install -Phadoop-2,dist
    
  6. In case you want to skip tests execution, run the earlier command with the following switch:
    mvn clean install –DskipTests -Phadoop-2,dist
    
  7. To generate a tarball file from the source code, run the following command:
    mvn clean package -DskipTests -Phadoop-2 -Pdist
    
You have been reading a chapter from
Apache Hive Cookbook
Published in: Apr 2016
Publisher: Packt
ISBN-13: 9781782161080
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image