Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Apache Hive Cookbook
  • Toc
  • feedback
Apache Hive Cookbook

Apache Hive Cookbook

By : Hanish Bansal, Saurabh Chauhan, Shrey Mehrotra
3 (4)
close
Apache Hive Cookbook

Apache Hive Cookbook

3 (4)
By: Hanish Bansal, Saurabh Chauhan, Shrey Mehrotra

Overview of this book

Hive was developed by Facebook and later open sourced in Apache community. Hive provides SQL like interface to run queries on Big Data frameworks. Hive provides SQL like syntax also called as HiveQL that includes all SQL capabilities like analytical functions which are the need of the hour in today’s Big Data world. This book provides you easy installation steps with different types of metastores supported by Hive. This book has simple and easy to learn recipes for configuring Hive clients and services. You would also learn different Hive optimizations including Partitions and Bucketing. The book also covers the source code explanation of latest Hive version. Hive Query Language is being used by other frameworks including spark. Towards the end you will cover integration of Hive with these frameworks.
Table of Contents (14 chapters)
close
13
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
    
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete