跳转到内容
搜索文档

其他函数

最后更新 查看 MarkdownAgent 设置

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

arrow_cast

将值转换为特定的 Arrow 数据类型:

arrow_cast(expression, datatype)

参数

  • expression: 要转换的表达式。 可以是常量、列或函数,以及算术或字符串运算符的任何组合。
  • datatype: 要转换到的 Arrow 数据类型 名称, 以字符串形式提供。格式与 [arrow_typeof] 返回的格式相同

示例

> select arrow_cast(-5, 'Int8') as a,
  arrow_cast('foo', 'Dictionary(Int32, Utf8)') as b,
  arrow_cast('bar', 'LargeUtf8') as c,
  arrow_cast('2023-01-02T12:53:02', 'Timestamp(Microsecond, Some("+08:00"))') as d
  ;
+----+-----+-----+---------------------------+
| a  | b   | c   | d                         |
+----+-----+-----+---------------------------+
| -5 | foo | bar | 2023-01-02T12:53:02+08:00 |
+----+-----+-----+---------------------------+
1 row in set. Query took 0.001 seconds.

arrow_typeof

返回表达式底层 Arrow 数据类型 的名称:

arrow_typeof(expression)

参数

  • expression: 要求值的表达式。 可以是常量、列或函数,以及算术或字符串运算符的任何组合。

示例

> select arrow_typeof('foo'), arrow_typeof(1);
+---------------------------+------------------------+
| arrow_typeof(Utf8("foo")) | arrow_typeof(Int64(1)) |
+---------------------------+------------------------+
| Utf8                      | Int64                  |
+---------------------------+------------------------+
1 row in set. Query took 0.001 seconds.

这篇文档对您有帮助吗?