You are reading the article Two Major Types With Sub updated in September 2023 on the website Dacvumuahe.com. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested October 2023 Two Major Types With SubWhat is Hive Function?
Hadoop, Data Science, Statistics & othersDifferent Hive Functions in Detail
Hive supports different data types that are not found in other database systems. it includes a map, array, and struct. Hive has some built-in functions to perform several mathematical and arithmetic functions for a special purpose. Functions in a hive can be categorized into the following types. They are built-in functions and user-defined functions.A) Built-in Functions
These functions extract data from the hive tables and process the calculations. Some of the built-in functions are:1. Mathematical/Numerical Functions
These functions are mainly used for mathematical calculations. These functions are used in SQL queries.
Function Name Example Description
ABS (double x) It will return the absolute value of a number.
CEIL (double x) It will fetch the smallest integer greater than or equal to value x.
Rand (), rand (int seed)
It returns a random number, depends on seed value the random numbers generated would be deterministic.
Pow (double x, double y) It returns x value raised to the y power.
FLOOR (double y) It returns a maximum integer less than or equal to give value y.
EXP (double a) It will return the exponent value of 30. the natural algorithm values.
PMOD (int a, int b) It gives the positive modulus of the number.2. Collection Functions
Function name Example Description
It fetches unordered array elements.
Returns the number of elements in the datatype map.
Array_contains (Array b) Returns TRUE if the array contains the value.
Sort_array (Array a) Sorts the input array in ascending order according to the natural ordering of the array elements and returns the value.3. String Functions
Using string functions data analysis is performed excellently.
Split (string s, string pat) It splits string around pat expressions and returns an array.
load(string s, int Len, string pad) It returns strings with right padding with the length of the string. (pad character).
Length (string str) This function returns the length of the string.
Rtrim (string a)
Output: ‘Topic ‘
It returns the result by trimming spaces from the right ends.
Concat (string m, string n) It results in the string by doing concatenation of two strings; this can take any number of inputs.
Reverse (string s) Returns the result of a reversed string.4. Date Function
It is necessary to have data format in a hive to prevent Null error in the output. It is necessary to have date compatibility to go with hive introduced date functions.
Unix_timestamp (String date, string pattern) Result: 124576 400 time taken: 0.146 seconds This function returns date to the specific format and returns seconds between date and Unix times.
Unix_timestamp (String date) It returns the date in ‘yyyy-MM-dd HH:mm: ss’ format into Unix timestamp.
Hour (String date) It returns the timestamp hour.5. Conditional Functions
If (Boolean test, T value true, t false) as IF_CONDITION_TEST; It checks with the condition if the value is true returns 1 and false returns 0.
Is not null(b) This fetches not null statements. if null returns false.
Coalesce (value1, value2) It fetches first not null values from the list of values.B) User-Defined Function (UDF)
1. Regular UDF: It works on a table with a single row. It is created by creating a java class, then packaging them into a .jar file; the next step is to verify with a hive classpath. then finally executing them in a hive query.
2. User-Defined Aggregate Function: They use aggregate functions like avg/ mean by implementing five methods init (), iterate (), partial (), merge (), terminate ().
3. User-Defined Table Generating Functions: It works with a single row in a table and results in multiple rows.Conclusion
In conclusion, we have learned how to work in the hive platform with built-in functions and user-defined functions in detail through this article. Most organizations have programmer and SQL developer to work on the server-side process, but an apache hive is a powerful tool which helps them to use Hadoop framework with no prior knowledge on programs and map-reduce. Hive helps new users to start and explore data analyzing without any barriers.Recommended Articles
This is a guide to the Hive Function. Here we discuss the basic concept, two different types of functions and sub-functions in the Hive. You can also go through our other suggested articles to learn more –
You're reading Two Major Types With Sub
Update the detailed information about Two Major Types With Sub on the Dacvumuahe.com website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!