Hadoop Hive Test case

  • date 31st May, 2019 |
  • by Prwatech |
  • 0 Comments

Hadoop Hive Test Case

 

Hadoop Hive Test Case, Welcome to the world of advanced Tutorials on test cases on Hadoop Hive. Are you looking forward to the Hadoop Hive test case Platform? Or looking for some help on the Hive client test case? Then you’ve landed on the Right Path which providing advanced tutorial Based concepts on the Hadoop Hive. In this tutorial, one can easily explore apache Hadoop Hive test cases with step by step explanation.

If you are the one who wanted to become an expert in Hadoop technology? Or the one who wanted to explore the technology like a Pro under the certified experts with world-class classroom training environment, then asks your Hadoop Training institute experts who offer Advanced advanced Hadoop training. Follow the below-mentioned Hadoop Hive test case tutorial and enhance your skills to become a professional Hadoop Developer.

 

Description: The basic objective of this project is to create a petrol consumption database using Hive in such a way that we can easily extract data for a particular set of instructions on the basis of the column. Using this technique we can easily sort and extract data from our database using a particular column as a reference.

 

Columns to Create

 

 1. Column 1: Pump ID

2. Column 2: Distributor Name

3. Column 3: Buy Rate(Per million)

4. Column 4: Sell Rate(Per million)

5. Column 5: VolumeIN(million cubic litter)

6. Column 6: VolumeOUT(million cubic litter)

7. Column 7: Year

 

Create table: Create a table with above-mentioned column names

 

CREATE TABLE if not exists petrol_info (distributer_id STRING,distributer_name STRING,amt_IN STRING,amy_OUT STRING,vol_IN INT,vol_OUT INT,year INT)

 

ROW FORMAT DELIMITED

FIELDS TERMINATED BY ‘,’

LINES TERMINATED BY ‘\n’

STORED AS TEXTFILE;

 

Hadoop Hive Test Case

 

Load Data from an external source: Load data into a table from an external source into the above-created table.

 

LOAD DATA LOCAL INPATH ‘/home/cloudera/Desktop/petrol.txt’ into table petrol_info;

 

Data Source:

https://drive.google.com/file/d/11Yle65LsT5H5uRAHrhgSRZHaZSTiUbH-/view?usp=sharing

 

Hadoop Hive Test Case

 

Case 1: What is the total amount of petrol in volume sold by every distributor

SOLUTION : SELECT distributer_name,SUM(vol_OUT) FROM petrol_info GROUP BY distributer_name;

 

 Hadoop Hive Test Case

Hadoop Hive Test Case

 

Case 2: Which are the top 10 distributors ID for selling petrol and also display the amount of petrol sold in volume by them individually?

 

SOLUTION: SELECT distributer_id,vol_OUT FROM petrol_info order by vol_OUT desc limit 10;

 

 Hadoop Hive Test Case

Hadoop Hive Test Case

 

Case 3: Find 10 distributor name who sold petrol in the least amount.

 

SOLUTION: SELECT distributer_id,vol_OUT FROM petrol_info order by vol_OUT limit 10;

 

Hadoop Hive Test Case

 

Hadoop Hive Test Case 2

 

Description: The basic objective of this project is to create an IPL statistic database using Hive in such a way that we can easily extract data for a particular set of instructions on the basis of the column. Using this technique we can easily sort and extract data from our database using a particular column as a reference.

Columns to Create

Player id

Jersey number

Player name

DOB

Handed

Matched Played

Run Rate

Runs

Country

 

Create table: Create a table with above-mentioned column names

 

CREATE TABLE if not exists ipl_info (player id INT,jersy_number INT,name STRING,DOB STRING,handed STRING,matches_played INT,run_rate INT,runs INT,country STRING)

ROW FORMAT DELIMITED

FIELDS TERMINATED BY ‘,’

LINES TERMINATED BY ‘\n’

STORED AS TEXTFILE;

 

 Hadoop Hive Test Case

 

Load Data from an external source: Load data into the table from an external source into the above-created table.

 

LOAD DATA LOCAL INPATH ‘/home/cloudera/Desktop/IPL.txt’ into table ipl_info;

Data Source:

 

https://drive.google.com/file/d/1rFQzqbS6CEqrM0TMrDMQBEP4sRm1yoCc/view?usp=sharing

 

Hadoop Hive Test Case

 

Case 1: Display name and runs of all batsmen with right-handed

Solution: select name,runs from ipl_info where handed = ‘Right-hand bat’;

 

Hadoop Hive Test Case

Hadoop Hive Test Case

 

Case 2: Display the detail of all batsmen with strike rate greater than 130

Solution : select jersy_number,country from ipl_info where run_rate > 130;

 

 Hadoop Hive Test Case

Hadoop Hive Test Case

 

Case 3: Display the name,runs scored by batsman of the same country

Solution : select jersy_number,runs from ipl_info where country = ‘India’;

 

Hadoop Hive Test Case

Hadoop Hive Test Case

 

Get success in your career as a Hadoop developer by being a part of the Prwatech, India’s leading Hadoop training institute in Bangalore.

0
0

Quick Support

image image