Date Datatype in Apache Hive

Have you ever questioned which field in the data is the most important? Have you ever wondered which column value is most critical for data analysis? DATE, without a doubt. A date dimension provides all of the data you need about a certain date, allowing developers, analysts, and users to evaluate data as quickly and accurately as possible.

Since Hive version 0.12.0, the “Date” data type has been available, while the “Timestamp” data type has been available since Hive version 0.8.0. “Date” and “date-time” values can be stored in these two data types.

Check the below example to work with “Date” and “Timestamp” data types.

Sample Data:
sampledata

Implementation:
CREATE TABLE TestDate(Date1 DATE, Date2 TIMESTAMP)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ‘,’;

LOAD DATA LOCAL INPATH ‘Desktop/Docs/DateTest.txt’ INTO TABLE TestDate;

Now verify the data:
SELECT * FROM TestDate;
OK
2021-07-08       2021-07-08 02:49:00

DateDataType_Hive

Hope you find this article helpful.

Please subscribe to get latest updates.

One comment

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