NAMED_STRUCT
Updated at:
Creates a struct based on given name-value pairs.
Syntax
struct named_struct(string <name1>, T1 <value1>, string <name2>, T2 <value2>[, ...])Parameters
value: required. A value of any type.
name: required. The column name of the STRING type. This parameter is a constant.
Return value
A value of the STRUCT type is returned. Columns are sequentially named as name1, name2, ....
Examples
-- The return value is {user_id:10001, user_name:LiLei, married:F, weight:63.5}.
select named_struct('user_id',10001,'user_name','LiLei','married','F','weight',63.50);Related functions
NAMED_STRUCT is a complex type function. For more information about the functions that are used to process data of complex data types, such as ARRAY, MAP, STRUCT, and JSON, Complex type functions.
Is this page helpful?