Book Image

Apache Hive Cookbook

Book Image

Apache Hive Cookbook

Overview of this book

Hive was developed by Facebook and later open sourced in Apache community. Hive provides SQL like interface to run queries on Big Data frameworks. Hive provides SQL like syntax also called as HiveQL that includes all SQL capabilities like analytical functions which are the need of the hour in today’s Big Data world. This book provides you easy installation steps with different types of metastores supported by Hive. This book has simple and easy to learn recipes for configuring Hive clients and services. You would also learn different Hive optimizations including Partitions and Bucketing. The book also covers the source code explanation of latest Hive version. Hive Query Language is being used by other frameworks including spark. Towards the end you will cover integration of Hive with these frameworks.
Table of Contents (19 chapters)
Apache Hive Cookbook
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
Index

Using miscellaneous data types


Hive supports two miscellaneous data types: Boolean and Binary:

Boolean accepts true or false values.

Binary is a sequence of bytes. It is similar to the VARBINARY data type found in many relational databases. If a field is declared as the binary type, then it is stored within a record, not separately like BLOBs. The binary data type is used when a record has hundreds of columns, and the user is just interested in a few columns and doesn't bother about an exact type information of other columns. In such cases, a user can define the type of those columns as binary, so Hive will not try to interpret those columns. It is used to include the arbitrary types in record, and Hive doesn't attempt to parse them as numbers, strings, and so on.

How to do it…

The following is the example in order to use the Boolean data types in Hive:

CREATE TABLE example (id INT, status BOOLEAN, description STRING);

The preceding statement creates a table, example, with the status as the Boolean...