Durga Gadiraju

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 »

Section 9:95. Date Manipulation – Getting Current Date and Timestamp

CURRENT_DATE: The CURRENT_DATE function returns the current date in ‘yyyy-MM-dd’ format. The syntax for the CURRENT_DATE function is as follows CURRENT_DATE For example: SELECT CURRENT_DATE; — Returns ‘2023-03-04’ (assuming today’s date is March 4, 2023) CURRENT_TIMESTAMP: The CURRENT_TIMESTAMP function returns the current timestamp in ‘yyyy-MM-dd HH:mm:ss’ format.  The syntax for the CURRENT_TIMESTAMP function is as …

Section 9:95. Date Manipulation – Getting Current Date and Timestamp Read More »

Section 9:94. String Manipulation – Reversing and concatenating multiple strings

In Hive, you can manipulate strings by reversing and concatenating them using built-in functions. REVERSE: The REVERSE function is used to reverse the characters in a string. The syntax for the REVERSE function is as follows REVERSE(input_string) For example: SELECT REVERSE(‘Hello World’); — Returns ‘dlroW olleH’ CONCAT: The CONCAT function is used to concatenate multiple …

Section 9:94. String Manipulation – Reversing and concatenating multiple strings Read More »

 Section 9:91. String Manipulation and Case conversion and Length

1.Case Conversion Functions: a. UPPER: Converts all characters in a string to uppercase. Example: SELECT UPPER(‘Hello World’); Output:` HELLO WORLD` b. LOWER: Converts all characters in a string to lowercase. Example: SELECT LOWER(‘Hello World’); Output: hello world c. INITCAP: Converts the first letter of each word in a string to uppercase. Example: SELECT INITCAP(‘hello world’); …

 Section 9:91. String Manipulation and Case conversion and Length Read More »

Section 9:90. Apache Hive – Overview of Functions

To validate functions in Hive, you can use the DESCRIBE FUNCTION statement. The DESCRIBE FUNCTION statement provides information about a specific function in Hive, including its syntax, parameters, and return type. You can also use the SHOW FUNCTIONS statement to list all the available functions in Hive.  SHOW FUNCTIONS; This output shows a list of …

Section 9:90. Apache Hive – Overview of Functions Read More »

Section 9:90. Apache Hive – Overview of Functions

To validate functions in Hive, you can use the DESCRIBE FUNCTION statement. The DESCRIBE FUNCTION statement provides information about a specific function in Hive, including its syntax, parameters, and return type. You can also use the SHOW FUNCTIONS statement to list all the available functions in Hive.  SHOW FUNCTIONS; This output shows a list of …

Section 9:90. Apache Hive – Overview of Functions Read More »