Functions in Hive are categorized as below.
Numeric and Mathematical Functions: These functions mainly used to perform mathematical calculations.
Date Functions: These functions are used to perform operations on date data types like adding the number of days to the date etc.
String Functions: These functions are used to perform operations on strings like finding the length of a string etc.
Conditional Functions: These functions are used to test conditions and returns a value based on whether the test condition is true or false.
Collection Functions: These functions are used to find the size of the complex types like array and map. The only collection function is SIZE. The SIZE function is used to find the number of elements in an array and map. The syntax of SIZE function is
SIZE( Array<A> ) and SIZE( MAP<key,value> )
Type Conversion Function: This function is used to convert from one data type to another. The only type conversion function is CAST. The syntax of CAST is
CAST( expr as <type> )
The CAST function converts the expr into the specified type.
Table Generating Functions: These functions transform a single row into multiple rows. EXPLODE is the only table generated function. This function takes array as an input and outputs the elements of array into separate rows. The syntax of EXPLODE is
EXPLODE( ARRAY<A> )
When you use the table generating functions in the SELECT clause, you cannot specify any other columns in the SELECT clause.
Numeric and Mathematical Functions: These functions mainly used to perform mathematical calculations.
Date Functions: These functions are used to perform operations on date data types like adding the number of days to the date etc.
String Functions: These functions are used to perform operations on strings like finding the length of a string etc.
Conditional Functions: These functions are used to test conditions and returns a value based on whether the test condition is true or false.
Collection Functions: These functions are used to find the size of the complex types like array and map. The only collection function is SIZE. The SIZE function is used to find the number of elements in an array and map. The syntax of SIZE function is
SIZE( Array<A> ) and SIZE( MAP<key,value> )
Type Conversion Function: This function is used to convert from one data type to another. The only type conversion function is CAST. The syntax of CAST is
CAST( expr as <type> )
The CAST function converts the expr into the specified type.
Table Generating Functions: These functions transform a single row into multiple rows. EXPLODE is the only table generated function. This function takes array as an input and outputs the elements of array into separate rows. The syntax of EXPLODE is
EXPLODE( ARRAY<A> )
When you use the table generating functions in the SELECT clause, you cannot specify any other columns in the SELECT clause.
0 comments:
Post a Comment