In addition to the Hive interactive CLI, Hive also allows us to execute our queries in the batch mode, using a script file. In this recipe, we use a Hive script file to create books, users, and ratings tables of the Book-Crossing dataset and to load the data into the newly created tables.
This section demonstrates how to create tables and load data using a Hive script file. Proceed with the following steps:
Extract the data package provided in the source repository of this chapter:
$ tar –zxvf chapter6-bookcrossing-data.tar.gz
Locate the
create-book-crossing.hql
Hive query file in the Hive-scripts folder of the source repository for this chapter. Execute this Hive script file as follows by providing the location of the extracted data package for theDATA_DIR
parameter. Please note that the execution of the following script file will overwrite any existing data in users, books, and ratings tables, if these exist beforehand, of the Book-Crossing...