跳转到内容
搜索文档

结构体函数

最后更新 查看 MarkdownAgent 设置

Cloudflare Pipelines 标量函数实现基于 Apache DataFusion(通过 Arroyo),本文档源自 DataFusion 函数参考。

struct

使用指定的输入表达式返回 Arrow 结构体。 返回结构体中的字段使用 cN 命名约定。 例如:c0c1c2 等。

struct(expression1[, ..., expression_n])

例如,此查询将两列 ab 转换为具有字段 c0c1 的单个结构体类型列:

select * from t;
+---+---+
| a | b |
+---+---+
| 1 | 2 |
| 3 | 4 |
+---+---+

select struct(a, b) from t;
+-----------------+
| struct(t.a,t.b) |
+-----------------+
| {c0: 1, c1: 2}  |
| {c0: 3, c1: 4}  |
+-----------------+

参数

  • expression_n: 要包含在输出结构体中的表达式。 可以是常量、列或函数,以及算术或字符串运算符的任何组合。

这篇文档对您有帮助吗?