Hive Unit VI
Hive Unit VI
Features of Hive
It stores schema in a database and processed data into
HDFS.
It is designed for OLAP.
into Hive and finally processed using the MapReduce framework. The Major
• Hive Clients
• Hive Services
• Distributed Storage
Hive Clients:
The Hive supports different types of client applications for performing
serve the request from all those languages that support Thrift.
apache.hadoop.hive.jdbc.HiveDriver.
Integral Types
Dates
Decimals
DECIMAL(precision, scale)
decimal(10,0)
Union Types
Union is a collection of heterogeneous data types.
You can create an instance using create union. The
syntax and example is as follows:
Literals
Decimal type data is nothing but floating point value with higher
range than DOUBLE data type. The range of decimal type is
approximately -10-308 to 10308.
Null Value
http://apache.petsads.us/hive/hive-0.14.0/
– $ cd Downloads
– $ ls
apache-hive-0.14.0-bin.tar.gz
export HIVE_HOME=/usr/local/hive
export PATH=$PATH:$HIVE_HOME/bin
export CLASSPATH=$CLASSPATH:/usr/local/Hadoop/lib/*:.
export CLASSPATH=$CLASSPATH:/usr/local/hive/lib/*:
$ source ~/.bashr
Step 5: Configuring Hive
line:
completed successfully.
db-derby-10.4.2.0-bin.tar.gz
Setting up environment for Derby
• You can set up the Derby environment by appending the following lines
to ~/.bashrc file:
Export DERBY_HOME=/usr/local/derby
export PATH=$PATH:$DERBY_HOME/bin
Apache Hive
18
• ExportCLASSPATH=$CLASSPATH:$DERBY_HOME/lib/derby.jar:
$DERBY_HOME/lib/derbytools.jar.
The following command is used to execute ~/.bashrc file:
$ source ~/.bashrc
Create a directory to store Metastore
• Create a directory named data in $DERBY_HOME directory to store
Metastore data.
• $ mkdir $DERBY_HOME/dataDerby installation and environmental setup is
now complete
Step 7: Verifying Hive Installation
• Before running Hive, you need to create the /tmp folder and a
separate Hive folder in HDFS. Here, we use
the /user/hive/warehouse folder. You need to set write permission
for these newly created folders as shown below:
chmod g+w
Now set them in HDFS before verifying Hive. Use the following
commands:
$ $HADOOP_HOME/bin/hadoop fs -mkdir /tmp