Export and Import a Hive Table/Partition

EXPORT We use EXPORT command to export data of a table or partition into a specified output location. The EXPORT command exports the metadata along-with the data at the output location. EXPORT a table :- EXPORT table employee to ‘/home/hadoop/employee’; EXPORT a partition :- EXPORT table employee partition(department=’BIGDATA’) to ‘/home/hadoop/employee_bigdata’;…

Continue reading

What is Hive

Apache Hive is a data warehouse infrastructure for querying, analyzing and summarizing the data stored in Hadoop’s HDFS. It provides an SQL-like language called HiveQL with schema on read and implicitly converts queries to MapReduce, Tez or Spark jobs. Some of the Hive features:- Different storage formats for data in…

Continue reading

Select Query with Group by clause in Hive

We will see how to write a Select query using Group by clause in Hive. Hive Table We have a table ‘Employee’ in Hive with the following schema and data. 0: jdbc:hive2://localhost:10000> desc Employee; +————-+————+———-+–+ |  col_name   | data_type  | comment  | +————-+————+———-+–+ | id          | bigint     |          | |…

Continue reading

Select Query with Where clause in Hive

We will see how to write simple ‘Select’ queries with Where clause in Hive. Hive Table We have a table ‘Employee’ in Hive with the following schema. 0: jdbc:hive2://localhost:10000> desc Employee; +————-+————+———-+–+ |  col_name   | data_type  | comment  | +————-+————+———-+–+ | id          | bigint     |          | | name        | string    …

Continue reading

Create, Use and Drop a Database in Hive

We will see how to Create, Use and Drop a database in Hive. Create a Database #List all the databases 0: jdbc:hive2://localhost:10000> show databases; +—————-+–+ | database_name  | +—————-+–+ | default        | +—————-+–+ #Create a new Database 0: jdbc:hive2://localhost:10000> create database mydb; #List all the databases 0: jdbc:hive2://localhost:10000> show databases;…

Continue reading

Different Approaches for Inserting Data Using Dynamic Partitioning into a Partitioned Hive Table

We will see different ways for inserting data using Dynamic partitioning into a Partitioned Hive table. To know how to create partitioned tables in Hive, go through the following links:- Creating Partitioned Hive table and importing data Creating Hive Table Partitioned by Multiple Columns and Importing Data Dynamic Partitioning Dynamic…

Continue reading