Updated on 2023-04-28 GMT+08:00

Querying a UDF

Basic SQL Syntax Supported

  • SLIMIT / SOFFSET
  • LIMIT / OFFSET
  • NON ALIGN
  • Queries with value filters
  • Queries with time filters

Currently, aligned time series are not supported in UDF queries. An error message is reported if you use UDF queries with aligned time series selected.

Queries with an Asterisk (*)

Assume that there are two time series (root.sg.d1.s1 and root.sg.d1.s2).

  • Execute the SELECT example(*) from root.sg.d1 statement.

    The result set contains the results of example(root.sg.d1.s1) and example(root.sg.d1.s2).

  • Execute the SELECT example(s1, *) from root.sg.d1 statement.

    The result set contains the results of example(root.sg.d1.s1, root.sg.d1.s1) and example(root.sg.d1.s1, root.sg.d1.s2).

  • Execute the SELECT example(*, *) from root.sg.d1 statement.

    The result set contains the results of 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), and example(root.sg.d1.s2, root.sg.d1.s2).

Queries with key-value pair attributes in UDF parameters

You can pass any number of key-value pair parameters to the UDF when constructing a UDF query. The key and value in a key-value pair must be enclosed in single or double quotation marks.

The key-value pair parameters can be passed in only after the time series have been passed in.

For example:

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;

Showing All Registered UDFs

Run the following SQL statement on the IoTDB client to view the registered UDFs:

SHOW FUNCTIONS