Enrollments closing soon for Post Graduate Certificate Program in Applied Data Science & AI By IIT Roorkee | 3 Seats Left
Apply NowLogin using Social Account
     Continue with GoogleLogin using your credentials
Many relational databases such as MySQL and PostgreSQL can be used for metastore in Hive. To accommodate different data types in relational databases, hive provides an extensive list of data types.
Let's go through data types in Hive.
Hive provides STRING, VARCHAR, and CHAR as string data types. Hive provides Boolean and Binary data types to store boolean values. Arrays support list of values. Arrays in Hive are similar to list in Java. Maps in Hive are similar to Java Maps. We can store key, value pairs in maps. structs in Hive are similar to structs in C. It is used to store complex data. A struct is basically a predefined key-value pair along with datatypes of the values. Union is a collection of heterogeneous data types. Union types can hold only one of their specified data types at any point of time for a record.
Let's understand how we will use various data types in the employees
table.
The name can be of varchar, char, or string data type. Salary is a float. Subordinates is an array having the list of subordinate names or ids. Deductions is a map. The address is of struct data type. A user can signup using social providers such as Facebook and google or using email id. So auth column is of union datatype. Please note that auth column can have only one data type from Facebook id, google id, and email at any point in time because users can signup using either Facebook, Google, or email.
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Loading comments...