You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@iotdb.apache.org by "Steve Yurong Su (Jira)" <ji...@apache.org> on 2021/09/07 09:39:00 UTC

[jira] [Created] (IOTDB-1647) Complex Arithmetic and Nested Operations in SELECT Clauses

Steve Yurong Su created IOTDB-1647:
--------------------------------------

             Summary: Complex Arithmetic and Nested Operations in SELECT Clauses
                 Key: IOTDB-1647
                 URL: https://issues.apache.org/jira/browse/IOTDB-1647
             Project: Apache IoTDB
          Issue Type: Sub-task
          Components: Core/Query
            Reporter: Steve Yurong Su
            Assignee: Steve Yurong Su
             Fix For: 0.13.0


+_This ticket is duplicated with https://issues.apache.org/jira/browse/COMDEV-409_+

 

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:
 # 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;

 # 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;

 # 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.
Example:
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.
Example:
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

Links:
[1] iotdb.apache.org



--
This message was sent by Atlassian Jira
(v8.3.4#803005)