Repository: incubator-eagle
Updated Branches:
  refs/heads/master dcb2b5de1 -> 158a1524b


Fixed wrongly aggregateCondition.getIntervalMS()

## Problem
When querying eagle storage like:
~~~
http://localhost:9090/rest/entities?query=GenericMetricService[site=%22sample%22]%3Csite%3E%7Bmax(value)%7D&metricName=hadoop.cluster.totalmemory&pageSize=100000&startTime=2016-09-19%2006:25:00&endTime=2016-09-19%2008:25:00&intervalmin=5&timeSeries=true
~~~
, the expected result should look like:

~~~
{
meta: {
firstTimestamp: 1474273440000,
totalResults: 1,
lastTimestamp: 1474266300000,
elapsedms: 1358
},
success: true,
obj: [
{
key: [
"apollo"
],
value: [
[
203633792,
205067904,
205115648,
205830912,
205980160,
205739392,
205809792,
204790400,
202791040,
202848768,
201649152,
198402176,
198410496,
201081088,
202256128,
203858304,
202554624,
200818304,
203813248,
203441536,
205401472,
206122368,
205884416,
206158976
]
]
}
],
type: "java.util.Map"
}
~~~

,

but actual is:

~~~
{
meta: {
firstTimestamp: 1474273440000,
totalResults: 1,
lastTimestamp: 1474266300000,
elapsedms: 9
},
success: true,
obj: [
{
key: [
"apollo"
],
value: [
[
206158976
]
]
}
],
type: "java.util.Map"
~~~

## Root Cause

Wrongly calculated milliseconds by
~~~
aggregateCondition.getIntervalMS() * 60 * 1000
~~~
should be
~~~
aggregateCondition.getIntervalMS()
~~~

Author: Hao Chen <h...@apache.org>

Closes #443 from haoch/EAGLE-553.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/158a1524
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/158a1524
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/158a1524

Branch: refs/heads/master
Commit: 158a1524bf016676f7f7b3ca52029b1cfd94afcd
Parents: dcb2b5d
Author: Hao Chen <h...@apache.org>
Authored: Tue Sep 20 13:40:30 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Tue Sep 20 13:40:30 2016 +0800

----------------------------------------------------------------------
 .../hbase/query/aggregate/GenericInMemoryAggregateQuery.java       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/158a1524/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/query/aggregate/GenericInMemoryAggregateQuery.java
----------------------------------------------------------------------
diff --git 
a/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/query/aggregate/GenericInMemoryAggregateQuery.java
 
b/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/query/aggregate/GenericInMemoryAggregateQuery.java
index 667390c..934929c 100644
--- 
a/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/query/aggregate/GenericInMemoryAggregateQuery.java
+++ 
b/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/query/aggregate/GenericInMemoryAggregateQuery.java
@@ -176,7 +176,7 @@ public class GenericInMemoryAggregateQuery implements 
GenericQuery {
             TimeSeriesAggregator tsAgg = new 
TimeSeriesAggregator(groupbyFields,
                 aggregateCondition.getAggregateFunctionTypes(), 
aggregateFields,
                     
DateTimeUtil.humanDateToDate(searchCondition.getStartTime()).getTime(),
-                
DateTimeUtil.humanDateToDate(searchCondition.getEndTime()).getTime(), 
aggregateCondition.getIntervalMS() * 60 * 1000);
+                
DateTimeUtil.humanDateToDate(searchCondition.getEndTime()).getTime(), 
aggregateCondition.getIntervalMS());
             reader.register(tsAgg);
 
             // for sorting

Reply via email to