struct function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime

Creates a STRUCT with the specified field values.


struct(expr1 [, ...] )


  • exprN: An expression of any type.


A struct with fieldN matching the type of exprN.

If the arguments are named references, the names are used to name the field. Otherwise, the fields are named colN, where N is the position of the field in the struct.


> SELECT struct(c1, c2, c3) FROM VALUES(1, 2, 3) AS T(c1, c2, c3);

> SELECT struct(1, 2, 3);