struct
function
Applies to: Databricks SQL
Databricks Runtime
Creates a STRUCT
with the specified field values.
Get started
Load & manage data
Work with data
Administration
Reference & resources
CLUSTER BY
clause (TABLE)mask
clauseROW FILTER
clauseAtualizado 18/02/2025
struct
function Applies to: Databricks SQL
Databricks Runtime
Creates a STRUCT
with the specified field values.
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);
{"c1":1,"c2":2,"c3":3}
> SELECT struct(1, 2, 3);
{"col1":1,"col2":2,"col3":3}