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:
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
Hope you find this article helpful.
Please subscribe to get latest updates.
One comment