Create Table With Delimiter and SELECT – Apache Hive

The following example shows how to create a table in Apache Hive with different delimiters, and with and without default location, a text file format as underlying structure, and a SELECT command.

Tabular Delimiter:
CREATE TABLE TestTable
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ‘\t’
LINES TERMINATED BY ‘\n’
STORED AS TEXTFILE
LOCATION ‘/user/cloudera/exttest’
AS
SELECT col1, col2 FROM SourceTable1 FROM WHERE <conditions>…

Comma Delimiter with default (/user/hive/datawarehouse) location:
CREATE TABLE TestTable
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ‘,’
STORED AS TEXTFILE
AS
SELECT col1, col2 FROM SourceTable1 FROM WHERE <conditions>…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s