[ https://issues.apache.org/jira/browse/IOTDB-1823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17429784#comment-17429784 ]
Jun Yuan commented on IOTDB-1823: --------------------------------- select count(speed) from root.** group by level = 1 Here, level=1 should be sg1 and sg2 rather than f1? > 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 > Priority: Major > Labels: pull-request-available > Original Estimate: 72h > Remaining Estimate: 72h > > Group by level is simliar to group by clause in relative database. > > For example, a relative table is like the following: > > |Time|storage_group|factory|device|temperature|speed| > |1|sg1|f1|d1|V|V| > |1|sg2|f1|d1|V|V| > |1|sg2|f1|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 = 3 > > |count(root.*..*.d1.speed)|count(root.*.*.d2.speed)| > |2|1| > 2. select storage_group, count(speed) from table group by factory > > |storage_group|count(speed)| > |f1|3| > > *In IoTDB:* > select count(speed) from root.** group by level = 1 > > |count(root.*f1.*.speed)| > |3| > > 3. *多层 level* > select count(speed) from table group by factory, device > |(To help understand)|count(speed)| > |f1.d1|2| > |f1.d2|1| > > *In IoTDB:* > select count(speed) from root.** group by level = 2, 3 > |count(root.*.f1.d1.speed)|count(root.*.f1.d2.speed)| > |2|1| > > 4. *limit 对应 slimit* > select count(speed) from table group by factory, device limit 1 > > |(To help understand)|count(speed)| > |f1.d1|2| > > *In IoTDB:* > select count(speed) from root.** group by level = 1, 2 *slimit 1* > |count(root.*.f1.d1.speed)| > |2| > -- This message was sent by Atlassian Jira (v8.3.4#803005)