#XMENU USER DEFINED LOCATION CODE#Some of UDFs are specifically designed for the reusability of code in application frameworks. User Defined Functions written in Java for specific modules. In Hive, the users can define own functions to meet certain client requirements. It will split text into key-value pairs using two delimiters. Splits str around pat (pat is a regular expression). It will fetch and gives a string of n spaces. It will fetch and returns the string resulting from trimming spaces from the end (right hand side) of Xįor example, rtrim(‘ results ‘) results in ‘ results’ It will fetch and gives str, which is right-padded with pad to a length of length(integer value) String manipulations and string operations these functions can be called. It will fetch and gives true if X is not NULL and false otherwise. It will fetch and gives true if X is NULL and false otherwise. If(Boolean testCondition, T valueTrue, T valueFalseOrNull) These functions used for conditional values checks. It will fetch and returns a random number that is distributed uniformly from 0 to 1 It will fetch and returns the minimum BIGINT value that is equal to or greater than X value It will fetch and returns the maximum BIGINT value that is equal to or less than X value It will fetch and returns the rounded BIGINT value of X using HALF_EVEN rounding mode It will fetch and returns X rounded to d decimal places It will fetch and returns the rounded BIGINT value of X Instead of creatingUDFs, we have some inbuilt mathematical functions in Hive. These functions are used for Mathematical Operations. It will fetch and gives date truncated to the unit specified by the format. It will fetch and gives the last day of the month which the date belongs to It will fetch and gives the current date at the start of query evaluation It will fetch and gives Subtraction of number of days to starting date It will fetch and gives the minute of the timestamp It will fetch and gives the hour of the timestamp It will give the month part of a date or a timestamp string It will fetch and give the quarter of the year for a date, timestamp, or string in the range 1 to 4 It will fetch and give the year part of a date or a timestamp string It will fetch and give the date part of a timestamp string: We will get current Unix timestamp in seconds These are used to perform Date Manipulations and Conversion of Date types from one type to another type: Function Name Sorts the input array in ascending order of array and elements and returns it It will fetch and gives an array containing the values of the input map. It will fetch and gives an array containing the keys of the input map. It will fetch and give the elements number in the array type It will fetch and give the components number in the map type Collections mean the grouping of elements and returning single or array of elements depends on return type mentioned in function name. These functions are used for collections. The syntax and types are mentioned in the following section. We can call these functions directly in our application. First, we have to check the application requirement, and then we can use these built-in functions in our applications. These are functions that are already available in Hive. Functions are built for a specific purpose to perform operations like Mathematical, arithmetic, logical, and relational on the operands of table column names.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |