Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Applies to:
Databricks SQL
Databricks Runtime
Explodes an array of structs into a table with OUTER semantics.
In in Databricks SQL and Databricks Runtime 16.1 and above this function supports named parameter invocation.
Syntax
inline_outer(input)
Arguments
input: An ARRAY < STRUCT > expression.
A set of rows composed of the fields in the struct elements of the array input.
The columns produced by inline are the names of the fields.
If input is NULL a single row with NULLs for each column is produced.
Applies to:
Databricks Runtime 12.1 and earlier:inline_outercan only be placed in theSELECTlist as the root of an expression or following a LATERAL VIEW. When placing the function in theSELECTlist there must be no other generator function in the sameSELECTlist or UNSUPPORTED_GENERATOR.MULTI_GENERATOR is raised.Applies to:
Databricks SQL
Databricks Runtime 12.2 LTS and above:Invocation from the LATERAL VIEW clause or the
SELECTlist is deprecated. Instead, invokeinline_outeras a table_reference.
Examples
Applies to:
Databricks Runtime 12.1 and earlier:
> SELECT inline_outer(array(struct(1, 'a'), struct(2, 'b'))), 'Spark SQL';
1 a Spark SQL
2 b Spark SQL
> SELECT inline_outer(array(struct(1, 'a'), struct(1, 'b'))),
inline_outer(array(struct('c', 1.0), struct('d', 2.0))),
'Spark SQL';
1 a Spark SQL
2 b Spark SQL
Error: UNSUPPORTED_GENERATOR.MULTI_GENERATOR
Applies to:
Databricks SQL
Databricks Runtime 12.2 LTS and above:
> SELECT i.*, 'Spark SQL'
FROM inline_outer(array(struct(1, 'a'), struct(2, 'b'))) AS i;
1 a Spark SQL
2 b Spark SQL
> SELECT i1.*, i2.*, 'Spark SQL'
FROM inline_outer(array(struct(1, 'a'), struct(1, 'b'))) AS i1,
inline_outer(array(struct('c', 1.0), struct('d', 2.0))) AS i2;
1 a c 1.0 Spark SQL
1 b c 1.0 Spark SQL
1 a d 2.0 Spark SQL
1 b d 2.0 Spark SQL