Struct Functions¶
This page lists all struct functions available in Spark SQL.
named_struct¶
named_struct(name1, val1, name2, val2, ...) - Creates a struct with the given field names and values.
Examples:
> SELECT named_struct("a", 1, "b", 2, "c", 3);
{"a":1,"b":2,"c":3}
Since: 1.5.0
struct¶
struct(col1, col2, col3, ...) - Creates a struct with the given field values.
Examples:
> SELECT struct(1, 2, 3);
{"col1":1,"col2":2,"col3":3}
Since: 1.4.0