struct function (Databricks SQL)

Creates a STRUCT with the specified field values.

Syntax

struct(expr1 [, ...] )

Arguments

  • exprN: An expression of any type.

Returns

A struct with fieldN matching the type of exprN.

Fields are named colN.

Examples

> SELECT struct(1, 2, 3);
 {1, 2, 3}