Uploaded image for project: 'Community Development'
  1. Community Development
  2. COMDEV-409

Apache IoTDB: Complex Arithmetic Operations in SELECT Clauses




      Apache IoTDB [1] is an Open Source IoT database designed to meet the rigorous data, storage, and analytics requirements of large-scale Internet of Things (IoT) and Industrial Internet of Things (IIoT) applications.

      We have recently been working to improve the ease of use of IoTDB. For queries, we hope that IoTDB can provide more powerful analysis capabilities.

      IOTDB supports many types of queries: raw data queries, function queries (including UDF queries), and so on. However, currently there is no easy way to combine the results of multiple queries. Therefore, we hope that IoTDB can support complex arithmetic operations in the SELECT clause, which will greatly improve the analysis capabilities.

      Function description:
      Applied to: raw time series, literal numbers and function outputs.
      Applicable data types: all types except TIMESTAMP and TEXT.
      Applicable operators: at least five binary operators ( + , - , * , / , % ) and two unary operator (+ , -).

      Usage examples:

      1. raw queries
        SELECT -a FROM root.sg.d;
        SELECT a, b, c, b * b - 4 * a * c FROM root.sg.d WHERE b > 0;
        SELECT a, b, -(bool_value * (a - b)) FROM root.sg.d;
        SELECT -3.14 + a / 15 + 926 FROM root.sg.d;
        SELECT +a % 3.14 FROM root.sg.d WHERE a < 0;
      1. function queries
        SELECT a + abs(a), sin(a) * cos(a) FROM root.sg.d;
        SELECT a, b, sqrt(a) * sqrt(b) / (a * b) FROM FROM root.sg.d WHERE a < 0;
      1. nested queries
        select a, b, a + b + udf(sin(a) * sin(b), cos(a) * cos(b)) FROM root.sg.d;
        select a, a + a, sin(sin(sin(a + a))) FROM root.sg.d WHERE a < 0;

      Additional requirements:
      1. For performance reasons, it's better to perform as few disk read operations as possible.
      SELECT a, sin(a + a) FROM root.sg.d WHERE a < 0;
      The series root.sg.d.a should be read only once during the query.

      2. For performance reasons, it's better to reuse intermediate calculation results as much as possible.
      SELECT a + a, sin(a + a) FROM root.sg.d WHERE a < 0;
      The intermediate calculation result a + a should only be evaluated once during the query.

      3. Need to consider memory-constrained scenarios.

      What knowledge you need to know:
      1. Java
      2. Basic database knowledge (such as SQL, etc.)
      3. ANTLR
      4. IoTDB query process

      [1] iotdb.apache.org


        Issue Links



              Unassigned Unassigned
              hxd Xiangdong Huang
              1 Vote for this issue
              2 Start watching this issue