Day: March 10, 2023

​Section 9:101.Overview of Numeric Functions

Hive provides a wide range of numeric functions that can be used for performing arithmetic, trigonometric, statistical, and other mathematical operations on numeric data. Here is an overview of some of the commonly used numeric functions in Hive: abs(x) – returns the absolute value of x. ceil(x) – returns the smallest integer that is greater …

​Section 9:101.Overview of Numeric Functions Read More »

Section 9:100. Date Manipulation – Extracting information using Year,month,day, etc

In Hive, you can work with Unix timestamps using the built-in from_unixtime() and unix_timestamp() functions. The unix_timestamp() function converts a string to a Unix timestamp, which is the number of seconds since January 1, 1970, 00:00:00 UTC. The syntax of the unix_timestamp() function is as follows: unix_timestamp(string date, string pattern) Here, date is the input …

Section 9:100. Date Manipulation – Extracting information using Year,month,day, etc Read More »

Section 9:99. Date Manipulation – Extracting information using Year,month,day, etc

1.year(date) – This function returns the year component of the given date. Example: SELECT year(‘2022-03-05’); returns 2022 2.month(date) – This function returns the month component of the given date. Example: SELECT month(‘2022-03-05’); returns 3 3.day(date) – This function returns the day of the month component of the given date. Example: SELECT day(‘2022-03-05’); returns 5 4.hour(timestamp) …

Section 9:99. Date Manipulation – Extracting information using Year,month,day, etc Read More »

Section 9:98. Date Manipulation – Extracting information using Date_format

The date_format() function in Hive is used to format a date or timestamp value as a string, according to a specified format string. The syntax of the date_format() function is as follows: date_format(date/timestamp, format) Here, date/timestamp is the input date or timestamp value that you want to format, and format is the format string that …

Section 9:98. Date Manipulation – Extracting information using Date_format Read More »

Section 9:96. Date Manipulation – Date Arithmetic

Hive provides a set of built-in functions for performing arithmetic operations on date and time values. Here are some of the common date arithmetic functions in Hive: date_add(date, int days) – This function adds a specified number of days to the given date and returns the resulting date. Example: SELECT date_add(‘2022-03-05’, 7); returns 2022-03-12 date_sub(date, …

Section 9:96. Date Manipulation – Date Arithmetic Read More »