Hive internal and external tables
The concept of a table in Hive is very similar to the table in the relational database. Each table associates with a directory configured in ${HIVE_HOME}/conf/hive-site.xml
in HDFS. By default, it is /user/hive/warehouse
in HDFS. For example, /user/hive/warehouse/employee
is created by Hive in HDFS for the employee
table. All the data in the table will be kept in the directory. The Hive table is also referred to as internal or managed tables.
When there is data already in HDFS, an external Hive table can be created to describe the data. It is called EXTERNAL
because the data in the external table is specified in the LOCATION
properties instead of the default warehouse directory. When keeping data in the internal tables, Hive fully manages the life cycle of the table and data. This means the data is removed once the internal table is dropped. If the external table is dropped, the table metadata is deleted but the data is kept. Most of the time, an external...