更新时间:2023-04-28 GMT+08:00
分享

使用UDF进行查询

支持的基础SQL语法

  • SLIMIT / SOFFSET
  • LIMIT / OFFSET
  • NON ALIGN
  • 支持值过滤
  • 支持时间过滤

UDF查询目前不支持对对齐时间序列“(Aligned Timeseries)”进行查询,若在SELECT子句中选择的序列中包含对齐时间序列时,会提示错误。

带“*”查询

假定现在有时间序列“root.sg.d1.s1”和“root.sg.d1.s2”。

  • 执行SELECT example(*) from root.sg.d1

    那么结果集中将包括“example(root.sg.d1.s1)”和“example(root.sg.d1.s2)”的结果。

  • 执行SELECT example(s1, *) from root.sg.d1

    那么结果集中将包括“example(root.sg.d1.s1, root.sg.d1.s1)”和“example(root.sg.d1.s1, root.sg.d1.s2)”的结果。

  • 执行SELECT example(*, *) from root.sg.d1

    那么结果集中将包括“example(root.sg.d1.s1, root.sg.d1.s1)”,“example(root.sg.d1.s2, root.sg.d1.s1)”,“example(root.sg.d1.s1, root.sg.d1.s2)” 和“ example(root.sg.d1.s2, root.sg.d1.s2)”的结果。

带自定义输入参数的查询

用户可以在进行UDF查询的时候,向UDF传入任意数量的键值对参数。键值对中的键和值都需要被单引号或者双引号引起来。

键值对参数只能在时间序列后传入。

例如:

SELECT example(s1, 'key1'='value1', 'key2'='value2'), example(*, 'key3'='value3') FROM root.sg.d1;
SELECT example(s1, s2, 'key1'='value1', 'key2'='value2') FROM root.sg.d1;

查看所有注册的UDF

在IoTDB客户端中执行下列SQL语句,可以查看所有注册的UDF:

SHOW FUNCTIONS
分享:

    相关文档

    相关产品