Continued from the previous MongoDB Exercise List
12. Working with Basic HDFS Commands.
Perform the following operations in Hadoop, and record its output.
a. To get the list of directories and files at the root of HDFS.
b. To get the list of complete directories and files of HDFS.
c. To create a directory (say, Student) in HDFS.
d. To copy a File from Local File System to HDFS.
e. To copy a File from HDFS to Local File System.
f. To copy a File from Local File System to HDFS (via copyFromLocal command)
g. To copy a File from HDFs to Local File System (via copyToLocal command)
h. To display the contents of an HDFS file on console.
i. To copy a file from one directory to another on HDFS.
j. To remove a directory from HDFS.
13. Write the HDFS command and execute the following to perform the following task:
a. view the list of directory in hdfs namespace
b. view the list of directories and subdirectories recursively in HDFS namespace
c. Create a directory ‘myfolder’
d. Copy 3 files from the local directory to HDFS
e. Copy a file from HDFS to local directory
f. Display the contents of the HDFS file on the screen
g. Create another HDFS directory ‘today’
h. copy all the files from the previously created HDFS directory to the newly created one
i. Remove the directory ‘myfolder’ from HDFS
j. Create another directory ‘tomorrow’ in HDFS
k. Move all the contents in the ‘today’ to ‘tomorrow’ directory
l. Delete the files inside the ‘tomorrow’ directory.
14. Using the Cloudera VM Ware, execute the word count program. Create the input and output
locations in HDFS to store the input files and output files. Display the contents of the output generated
on the console.
15. Working with HIVE
Perform the following operations in HIVE and record its output.
a. Create a database named "FACULTY" with comments and database properties.
b. To Display a list of all databases.
c. To describe the database.
d. To alter the database properties.
e. To make the database as the current working database.
f. To drop the database
g. To create a table called “College” and load data into it from a file “college.tsv”.
h. Retrieve the college details and display it in the console.
16. Create a partition table for customer schema to reward the customers based on their lifetime values
a. The input has to be the following
i. Customer ID
ii. Customers
iii. Life time value
b. Create a partition table if the LifeTimeValue is 12000
c. Create a partition table for all LifeTimeValue
17. Create a table Order and customer for the following schemas
● Order
o CustomerID
o ItemID
o ItemName
o OrderDate
o DeliveryDate
● Customer
o CustomerID
o CustomerName
o Address
o City
o State
o Country
a. Create a table for Order and Customer Data
b. Write a HQL to find the number of items bought by each customer.
18. Create a table for Student and Department in Hive with the following fields:
Student : StudentId, StudentName, Studentcity and Gpa.
Department : StudentId, DepartmentId, DepartmentName, DepartmentCollege.
Join both the tables using StudentId as the Join Key, and display the data
19. Create a partition table in Hive for customer schema to reward the customers based on
their life time values.
Customer Id Customers Life Time Value
1001 Jack 25000
1002 Jill 27400
1003 Dan 12000
1004 Dim 12000
1005 Rak 21000
Create a partition table if life time values are 25000 and above.