Showing posts with label External Keyword Missing while creating the hive external table. Show all posts
Showing posts with label External Keyword Missing while creating the hive external table. Show all posts

Friday, August 14, 2020

Hive Internal Table - With External Data

Have you ever wonder what will happen if you miss the "external" keyword while creating an external table?

Let's check it out.

Here is my sample data. It has three columns namely dno, dname, location.

11, marketing, hyd
12, hr, delhi
13, finance, bang
14, retail, madras
20, db, hyd
21, mg, madras

This file has been placed in /user/cloudera/NewEmpDir as dept.txt

Let us create the external table on top of this data without using "external" keyword.

 

CREATE TABLE newDept

(Dno INT, Dname String, loc String)

ROW FORMAT DELIMITED

FIELDS TERMINATED BY ','

LOCATION '/user/cloudera/NewEmpDir'; 

Surprisingly, the table will be created and the data will also be loaded without any errors.


This is more like an internal table but the data is not stored in Hive. The following things to be observed.

  • Unlike other tables, this table cannot be visible when you browse the files through Hue, though it is visible in Metastore Manager.
  • You can query and retrieve the data from the table.
  • If you drop this table, the source file and directory will also be deleted.


Big Data & SQL

Hi Everybody, Please do visit my new blog that has much more information about Big Data and SQL. The site covers big data and almost all the...