You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2019/10/10 01:48:50 UTC

[GitHub] [incubator-iotdb] jt2594838 commented on a change in pull request #433: [IOTDB-203]add "group by device" function for narrow table display

jt2594838 commented on a change in pull request #433: [IOTDB-203]add "group by device" function for narrow table display
URL: https://github.com/apache/incubator-iotdb/pull/433#discussion_r332798781
 
 

 ##########
 File path: docs/Documentation/UserGuide/5-IoTDB SQL Documentation/1-IoTDB Query Statement.md
 ##########
 @@ -245,20 +245,77 @@ Note: <FillClause> can not use <LIMITClause> but not <SLIMITClause>.
 ```
 GroupbyDeviceClause : GROUP BY DEVICE
 
-Note: 
-- Both uppercase and lowercase are ok.
-- GroupbyDeviceClause can only be used in the end of a query statement.
-
-Eg: 
-- select * from root.vehicle group by device
-- select s0,s0,s1 from root.vehicle.* group by device
-- select s0,s1 from root.vehicle.* limit 10 offset 1 group by device
-- select * from root.vehicle slimit 10 soffset 2 group by device
-- select * from root.vehicle where time>10 group by device
-- select * from root.vehicle where root.vehicle.d0.s0>0 group by device
-- select count(*) from root.vehicle group by device
-- select sum(*) from root.vehicle GROUP BY (20ms,0,[2,50]) group by device
-- select * from root.vehicle where time = 3 Fill(int32[previous, 5ms]) group by device
+Rules:  
+1. Both uppercase and lowercase are ok.  
+Correct example: select * from root.sg1 group by device  
+Correct example: select * from root.sg1 GROUP BY DEVICE  
+
+2. GroupbyDeviceClause can only be used at the end of a query statement.  
+Correct example: select * from root.sg1 where time > 10 group by device  
+Wrong example: select * from root.sg1 group by device where time > 10  
+
+3. The paths of the SELECT clause can only be single level. In other words, the paths of the SELECT clause can only be measurements or STAR, without DOT.
+Correct example: select s0,s1 from root.sg1.* group by device  
+Correct example: select s0,s1 from root.sg1.d0, root.sg1.d1 group by device  
+Correct example: select * from root.sg1.* group by device  
+Correct example: select * from root group by device  
+Correct example: select s0,s1,* from root.*.* group by device  
+Wrong example: select d0.s1, d0.s2, d1.s0 from root.sg1 group by device  
+Wrong example: select *.s0, *.s1 from root.* group by device  
+Wrong example: select *.*.* from root group by device
+
+4. The data types of the same measurement column should be the same across devices. 
+Note that when it comes to aggregated paths, the data type of the measurement column will reflect 
+the aggregation function rather than the original timeseries.
 
 Review comment:
   We are considering removing this constraint in IoTDB.
   https://issues.apache.org/jira/projects/IOTDB/issues/IOTDB-245?filter=allopenissues
   When it is done, the functionality of "group by device" will be limited.
   Here is my thought, upon finding different data types of the same measurement, the data type of the result set will be cast to the compatible one automatically, for example:
   If d0.s0 is INT32, and d1.s0 is INT64, the data type of s0 will be INT64. (Or you can simply cast all numeric types to DOUBLE, and booleans are considered 0s and 1s).
   If any of the data types is TEXT, the result data type will be TEXT. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services