[ https://issues.apache.org/jira/browse/IOTDB-59?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
suyue closed IOTDB-59. ---------------------- > GroupBy module > -------------- > > Key: IOTDB-59 > URL: https://issues.apache.org/jira/browse/IOTDB-59 > Project: Apache IoTDB > Issue Type: New Feature > Reporter: suyue > Assignee: suyue > Priority: Major > > h3. Down-Frequency Aggregate Query > Groupby is used to partition the result set according to the user’s given > partitioning conditions and aggregate the partitioned result set. IoTDB > supports partitioning result sets according to time intervals, and by default > results are sorted by time in ascending order. You can also use the [Java > JDBC|http://iotdb.apache.org/Java-api-page,commingsoon] standard interface to > execute related queries. > The GROUP BY statement provides users with three types of specified > parameters: > * Parameter 1: Time interval for dividing the time axis > * Parameter 2: Time axis origin position (optional) > * Parameter 3: The display window(s) (one or more) on the time axis > The actual meanings of the three types of parameters are shown in Figure 1 > below. Among them, the paramter 2 is optional. Next we will give three > typical examples of frequency reduction aggregation: parameter 2 specified, > parameter 2 not specified, and time filtering conditions specified. > !https://user-images.githubusercontent.com/13203019/51577465-e8513380-1ef4-11e9-84c6-d0690f2a8113.jpg|width=597,height=213! > *Figure 1 The actual meanings of the three types of parameters* > h4. Down-Frequency Aggregate Query without Specifying the Time Axis Origin > Position > The SQL statement is: > ''' > select count(status), max_value(temperature) from root.ln.wf01.wt01 group by > (1d, [2017-11-01T00:00:00, 2017-11-07T23:00:00]); > ''' > which means: > Since the user does not specify the time axis origin position, the GROUP BY > statement will by default set the origin at 0 (+0 time zone) on January 1, > 1970. > The first parameter of the GROUP BY statement above is the time interval for > dividing the time axis. Taking this parameter (1d) as time interval and the > default origin as the dividing origin, the time axis is divided into several > continuous intervals, which are [0,1d], [1d, 2d], [2d, 3d], etc. > The second parameter of the GROUP BY statement above is the display window > paramter, which determines the final display range is [2017-11-01T00:00:00, > 2017-11-07T23:00:00]. > Then the system will use the time and value filtering condition in the WHERE > clause and the second parameter of the GROUP BY statement as the data > filtering condition to obtain the data satisfying the filtering condition > (which in this case is the data in the range of [2017-11-01T00:00:00, > 2017-11-07 T23:00:00]), and map these data to the previously segmented time > axis (in this case there are mapped data in every 1-day period from > 2017-11-01T00:00:00 to 2017-11-07T23:00:00:00). -- This message was sent by Atlassian JIRA (v7.6.3#76005)