iotdb icon indicating copy to clipboard operation
iotdb copied to clipboard

前缀路径聚合问题

Open stefaniexin opened this issue 8 years ago • 3 comments

IoTDB> select * from root
+-----------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+
|                   Time|root.turbine.Shanghai.d2.Energy|root.turbine.Shanghai.d3.Energy| root.turbine.Shanghai.d3.Speed| root.turbine.Beijing.d2.Energy|  root.turbine.Beijing.d2.Speed|
+-----------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+
|2017-12-01T00:22:59.334|                           null|                           null|                           null|                      27.928814|                              1|
|2017-12-01T00:22:59.855|                           null|                           null|                           null|                      25.391584|                              0|
|2017-12-01T00:23:00.269|                           null|                           null|                           null|                      29.979698|                              8|
|2017-12-01T00:23:00.698|                           null|                           null|                           null|                      22.309273|                              3|
|2017-12-01T00:23:01.117|                           null|                           null|                           null|                      29.748756|                             11|
|2017-12-01T00:23:01.539|                           null|                           null|                           null|                      20.662369|                              4|
|2017-12-01T00:23:01.959|                           null|                       23.56449|                              6|                       26.08468|                              4|
|2017-12-01T00:23:02.382|                           null|                      26.359634|                              3|                      20.690254|                              0|
|2017-12-01T00:23:02.795|                           null|                      28.777403|                              8|                      23.677143|                             13|
|2017-12-01T00:23:03.218|                           null|                      27.712833|                              3|                      20.305994|                              5|
|2017-12-01T00:23:03.638|                           null|                      29.470375|                              9|                      22.673237|                              7|
|2017-12-01T00:23:04.060|                           null|                      28.339792|                              0|                      25.473534|                             13|
|2017-12-01T00:23:04.481|                           null|                      20.276184|                              5|                       26.35075|                             10|
|2017-12-01T00:23:04.899|                           null|                      21.032091|                              2|                      22.565153|                              3|
|2017-12-01T00:23:05.317|                           null|                      28.488579|                              1|                      27.924906|                              4|
|2017-12-01T00:23:05.735|                           null|                      28.298925|                              8|                      28.964344|                              7|
|2017-12-01T00:23:06.155|                           null|                       26.81476|                              0|                      25.271076|                              3|
|2017-12-01T00:23:06.575|                           null|                      29.723043|                           null|                      23.091873|                             12|
+-----------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+
record number = 18
execute successfully.
IoTDB> select count(d2) from root.turbine.Shanghai
+-----------------------+--------------------------------------+
|                   Time|count(root.turbine.Shanghai.d2.Energy)|
+-----------------------+--------------------------------------+
+-----------------------+--------------------------------------+
record number = 0
execute successfully.
IoTDB> select count(d3) from root.turbine.Shanghai
+-----------------------+--------------------------------------+--------------------------------------+
|                   Time|count(root.turbine.Shanghai.d3.Energy)| count(root.turbine.Shanghai.d3.Speed)|
+-----------------------+--------------------------------------+--------------------------------------+
+-----------------------+--------------------------------------+--------------------------------------+
record number = 0
execute successfully.
IoTDB> select count(d3) from root.turbine.Shanghai
+-----------------------+--------------------------------------+--------------------------------------+
|                   Time|count(root.turbine.Shanghai.d3.Energy)| count(root.turbine.Shanghai.d3.Speed)|
+-----------------------+--------------------------------------+--------------------------------------+
|1970-01-01T08:00:00.000|                                    12|                                    11|
+-----------------------+--------------------------------------+--------------------------------------+
record number = 1
execute successfully.
IoTDB> select count(d2) from root.turbine.Shanghai
+-----------------------+--------------------------------------+
|                   Time|count(root.turbine.Shanghai.d2.Energy)|
+-----------------------+--------------------------------------+
+-----------------------+--------------------------------------+
record number = 0
execute successfully.
IoTDB> select count(d3) from root.turbine.Shanghai
+-----------------------+--------------------------------------+--------------------------------------+
|                   Time|count(root.turbine.Shanghai.d3.Energy)| count(root.turbine.Shanghai.d3.Speed)|
+-----------------------+--------------------------------------+--------------------------------------+
+-----------------------+--------------------------------------+--------------------------------------+
record number = 0
execute successfully.
IoTDB> select count(d3) from root.turbine.Shanghai
+-----------------------+--------------------------------------+--------------------------------------+
|                   Time|count(root.turbine.Shanghai.d3.Energy)| count(root.turbine.Shanghai.d3.Speed)|
+-----------------------+--------------------------------------+--------------------------------------+
|1970-01-01T08:00:00.000|                                    12|                                    11|
+-----------------------+--------------------------------------+--------------------------------------+
record number = 1
execute successfully.

在count(d2)之后再做count(d3)才会出问题,单独做count(d3)不会出问题。怀疑因为root.turbine.Shanghai.d2.Energy列为空列,所以count出错。所以向其中插入了一条数据。便没有bug了。

IoTDB> select * from root
+-----------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+
|                   Time|root.turbine.Shanghai.d2.Energy|root.turbine.Shanghai.d3.Energy| root.turbine.Shanghai.d3.Speed| root.turbine.Beijing.d2.Energy|  root.turbine.Beijing.d2.Speed|
+-----------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+
|1970-01-01T08:00:12.345|                          -2000|                           null|                           null|                           null|                           null|
|2017-12-01T00:22:59.334|                           null|                           null|                           null|                      27.928814|                              1|
|2017-12-01T00:22:59.855|                           null|                           null|                           null|                      25.391584|                              0|
|2017-12-01T00:23:00.269|                           null|                           null|                           null|                      29.979698|                              8|
|2017-12-01T00:23:00.698|                           null|                           null|                           null|                      22.309273|                              3|
|2017-12-01T00:23:01.117|                           null|                           null|                           null|                      29.748756|                             11|
|2017-12-01T00:23:01.539|                           null|                           null|                           null|                      20.662369|                              4|
|2017-12-01T00:23:01.959|                           null|                       23.56449|                              6|                       26.08468|                              4|
|2017-12-01T00:23:02.382|                           null|                      26.359634|                              3|                      20.690254|                              0|
|2017-12-01T00:23:02.795|                           null|                      28.777403|                              8|                      23.677143|                             13|
|2017-12-01T00:23:03.218|                           null|                      27.712833|                              3|                      20.305994|                              5|
|2017-12-01T00:23:03.638|                           null|                      29.470375|                              9|                      22.673237|                              7|
|2017-12-01T00:23:04.060|                           null|                      28.339792|                              0|                      25.473534|                             13|
|2017-12-01T00:23:04.481|                           null|                      20.276184|                              5|                       26.35075|                             10|
|2017-12-01T00:23:04.899|                           null|                      21.032091|                              2|                      22.565153|                              3|
|2017-12-01T00:23:05.317|                           null|                      28.488579|                              1|                      27.924906|                              4|
|2017-12-01T00:23:05.735|                           null|                      28.298925|                              8|                      28.964344|                              7|
|2017-12-01T00:23:06.155|                           null|                       26.81476|                              0|                      25.271076|                              3|
|2017-12-01T00:23:06.575|                           null|                      29.723043|                           null|                      23.091873|                             12|
+-----------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+
record number = 19
execute successfully.
IoTDB> select count(d2) from root.turbine.Shanghai
+-----------------------+--------------------------------------+
|                   Time|count(root.turbine.Shanghai.d2.Energy)|
+-----------------------+--------------------------------------+
|1970-01-01T08:00:00.000|                                     1|
+-----------------------+--------------------------------------+
record number = 1
execute successfully.
IoTDB> select count(d3) from root.turbine.Shanghai
+-----------------------+--------------------------------------+--------------------------------------+
|                   Time|count(root.turbine.Shanghai.d3.Energy)| count(root.turbine.Shanghai.d3.Speed)|
+-----------------------+--------------------------------------+--------------------------------------+
|1970-01-01T08:00:00.000|                                    12|                                    11|
+-----------------------+--------------------------------------+--------------------------------------+
record number = 1
execute successfully.

stefaniexin avatar Nov 30 '17 16:11 stefaniexin

这个bug已经修复了吗?

MyXOF avatar Dec 01 '17 05:12 MyXOF

这个还有些问题,现在不确定对于没有值的列count, max_value到底该输出什么,建议试一下mysql对于没有数据的列max_value, count之类输出什么

Beyyes avatar Dec 01 '17 07:12 Beyyes

这个issue对于普通的聚合已经不存在问题。对于group by的某个切割部分来说如果没有数据的话,count也显示0吗?我认为显示null也是可以的。

Beyyes avatar Dec 06 '17 11:12 Beyyes