Lei Rui created IOTDB-331:
-----------------------------

             Summary: [0.9.0]A groupBy query bug when 
axisOrigin-startTimeOfWindow is an integral multiple of interval
                 Key: IOTDB-331
                 URL: https://issues.apache.org/jira/browse/IOTDB-331
             Project: Apache IoTDB
          Issue Type: Bug
            Reporter: Lei Rui


 
{code:java}
SET STORAGE GROUP TO root.ln.wf01.wt01
CREATE TIMESERIES root.ln.wf01.wt01.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN
CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=DOUBLE, 
ENCODING=PLAIN
CREATE TIMESERIES root.ln.wf01.wt01.hardware WITH DATATYPE=INT32, ENCODING=PLAIN
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) values(1, 
1.1, false, 11)
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) values(2, 
2.2, true, 22)
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) values(3, 
3.3, false, 33)
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) values(4, 
4.4, false, 44)
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) values(5, 
5.5, false, 55)
flush
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) 
values(100, 100.1, false, 110)
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) 
values(150, 200.2, true, 220)
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) 
values(200, 300.3, false, 330)
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) 
values(250, 400.4, false, 440)
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) 
values(300, 500.5, false, 550)
flush
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) 
values(10, 10.1, false, 110)
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) 
values(20, 20.2, true, 220)
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) 
values(30, 30.3, false, 330)
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) 
values(40, 40.4, false, 440)
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) 
values(50, 50.5, false, 550)
flush
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) 
values(500, 100.1, false, 110)
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) 
values(510, 200.2, true, 220)
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) 
values(520, 300.3, false, 330)
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) 
values(530, 400.4, false, 440)
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) 
values(540, 500.5, false, 550)
flush
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) 
values(580, 100.1, false, 110)
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) 
values(590, 200.2, true, 220)
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) 
values(600, 300.3, false, 330)
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) 
values(610, 400.4, false, 440)
INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) 
values(620, 500.5, false, 550)

select count(temperature), sum(temperature), avg(temperature) from 
root.ln.wf01.wt01 where temperature > 3 GROUP BY (20ms, 25,[5,30], [35,37], 
[50, 160], [310, 314])
{code}
Note that in the above groupBy query, 25-5=1*20.

The result of the above query is:

 
{code:java}
5,0,0.0,null // This is not right
5,3,35.8,11.933333333333332
25,1,30.3,30.3
50,1,50.5,50.5
65,0,0.0,null
85,1,100.1,100.1
105,0,0.0,null
125,0,0.0,null
145,1,200.2,200.2
310,0,0.0,null
{code}



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

Reply via email to