You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@iotdb.apache.org by "Alima777 (Jira)" <ji...@apache.org> on 2021/10/12 06:45:00 UTC

[jira] [Created] (IOTDB-1823) Support group by multi level

Alima777 created IOTDB-1823:
-------------------------------

             Summary: Support group by multi level 
                 Key: IOTDB-1823
                 URL: https://issues.apache.org/jira/browse/IOTDB-1823
             Project: Apache IoTDB
          Issue Type: Task
            Reporter: Alima777
            Assignee: Alima777


Group by level is simliar to group by clause in relative database.

 

For example, a relative table is like the following:

 
|Time|storage_group|device|temperature|speed|
|1|sg1|d1|V|V|
|1|sg2|d1|V|V|
|1|sg2|d2|V|V|

 

Then the group by query may be like: 

1. select device, count(speed) from table group by device

the result will be:
|device|count(speed)|
|d1|2|
|d2|1|

 

*In IoTDB:*

select count(speed) from root.** group by level = 2

 
|count(root.*.d1.speed)|count(root.*.d2.speed)|
|2|1|


2. select storage_group, count(speed) from table group by storage_group

 
|storage_group|count(speed)|
|sg1|1|
|sg2|2|

 

*In IoTDB:*

select count(speed) from root.** group by level = 1

 
|count(root.sg1.*.speed)|count(root.sg2.*.speed)|
|1|2|

 

3. select count(speed) from table group by device, storage_group


|(To help understand)|count(speed)|
|sg1.d1|1|
|sg2.d1|1|
|sg2.d2|1|

 

*In IoTDB:*

select count(speed) from root.** group by level = 1, 2
|count(root.sg1.d1.speed)|count(root.sg2.d1.speed)|count(root.sg2.d2.speed)|
|1|1|1|



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