Repository: incubator-eagle
Updated Branches:
  refs/heads/master 14d55dd51 -> dc9fe0b47


[EAGLE-427] support timestamp in a query statement

https://issues.apache.org/jira/browse/EAGLE-427

Author: Zhao, Qingwen <qingwz...@apache.org>

Closes #672 from qingwen220/EAGLE-427.


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

Branch: refs/heads/master
Commit: dc9fe0b4735d4900922de9019e54d478cb49c4d2
Parents: 14d55dd
Author: Zhao, Qingwen <qingwz...@apache.org>
Authored: Tue Nov 22 14:27:32 2016 +0800
Committer: Zhao, Qingwen <qingwz...@apache.org>
Committed: Tue Nov 22 14:27:32 2016 +0800

----------------------------------------------------------------------
 .../org/apache/eagle/common/DateTimeUtil.java   |  8 ++++++
 .../entity/GenericEntityScanStreamReader.java   |  4 +--
 .../log/entity/GenericEntityStreamReaderMT.java | 12 ++++-----
 ...ricMetricEntityDecompactionStreamReader.java |  4 +--
 .../eagle/log/entity/SearchCondition.java       | 12 ++++-----
 .../apache/eagle/query/TestHBaseLogReader2.java | 28 ++++++++------------
 .../common/SplitFullScanEntityReader.java       |  4 +--
 .../service/generic/ListQueryResource.java      | 10 +++----
 .../eagle/storage/operation/CompiledQuery.java  | 16 +++++------
 .../GenericCoprocessorAggregateQuery.java       |  8 +++---
 .../GenericInMemoryAggregateQuery.java          |  8 +++---
 11 files changed, 57 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/dc9fe0b4/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/DateTimeUtil.java
----------------------------------------------------------------------
diff --git 
a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/DateTimeUtil.java
 
b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/DateTimeUtil.java
index 8d6814b..e7ef3f8 100644
--- 
a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/DateTimeUtil.java
+++ 
b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/DateTimeUtil.java
@@ -161,4 +161,12 @@ public class DateTimeUtil {
         Date d = sdf.parse(date);
         return d.getTime();
     }
+
+    public static long parseTimeStrToMilliseconds(String timeStr) throws 
ParseException {
+        try {
+            return Long.valueOf(timeStr);
+        } catch (Exception ex) {
+            return humanDateToSeconds(timeStr) * ONESECOND;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/dc9fe0b4/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericEntityScanStreamReader.java
----------------------------------------------------------------------
diff --git 
a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericEntityScanStreamReader.java
 
b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericEntityScanStreamReader.java
index 3f97e78..e0a7119 100755
--- 
a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericEntityScanStreamReader.java
+++ 
b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericEntityScanStreamReader.java
@@ -80,8 +80,8 @@ public class GenericEntityScanStreamReader extends 
StreamReader {
                }
                // Process the time range if needed
                if(entityDef.isTimeSeries()){
-                       start = 
DateTimeUtil.humanDateToDate(condition.getStartTime());
-                       end = 
DateTimeUtil.humanDateToDate(condition.getEndTime());
+                       start = new Date(condition.getStartTime());
+                       end = new Date(condition.getEndTime());
                }else{
                        start = 
DateTimeUtil.humanDateToDate(EntityConstants.FIXED_READ_START_HUMANTIME);
                        end = 
DateTimeUtil.humanDateToDate(EntityConstants.FIXED_READ_END_HUMANTIME);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/dc9fe0b4/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericEntityStreamReaderMT.java
----------------------------------------------------------------------
diff --git 
a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericEntityStreamReaderMT.java
 
b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericEntityStreamReaderMT.java
index 1946d6c..bf72a36 100755
--- 
a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericEntityStreamReaderMT.java
+++ 
b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericEntityStreamReaderMT.java
@@ -43,8 +43,8 @@ public class GenericEntityStreamReaderMT extends StreamReader{
        public GenericEntityStreamReaderMT(String serviceName, SearchCondition 
condition, int numThreads) throws Exception{
                checkIsTimeSeries(serviceName);
                checkNumThreads(numThreads);
-               long queryStartTime = 
DateTimeUtil.humanDateToSeconds(condition.getStartTime())*1000;
-               long queryEndTime = 
DateTimeUtil.humanDateToSeconds(condition.getEndTime())*1000;
+               long queryStartTime = condition.getStartTime();
+               long queryEndTime = condition.getEndTime();
                long subStartTime = queryStartTime;
                long subEndTime = 0;
                long interval = (queryEndTime-queryStartTime) / numThreads;
@@ -56,11 +56,11 @@ public class GenericEntityStreamReaderMT extends 
StreamReader{
                        }else{
                                subEndTime = subStartTime + interval;
                        }
-                       String strStartTime = 
DateTimeUtil.millisecondsToHumanDateWithSeconds(subStartTime);
-                       String strEndTime = 
DateTimeUtil.millisecondsToHumanDateWithSeconds(subEndTime);
+                       //String strStartTime = 
DateTimeUtil.millisecondsToHumanDateWithSeconds(subStartTime);
+                       //String strEndTime = 
DateTimeUtil.millisecondsToHumanDateWithSeconds(subEndTime);
                        SearchCondition sc = new SearchCondition(condition);
-                       sc.setStartTime(strStartTime);
-                       sc.setEndTime(strEndTime);
+                       sc.setStartTime(subStartTime);
+                       sc.setEndTime(subEndTime);
                        GenericEntityStreamReader reader = new 
GenericEntityStreamReader(serviceName, sc);
                        readers.add(reader);
                }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/dc9fe0b4/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericMetricEntityDecompactionStreamReader.java
----------------------------------------------------------------------
diff --git 
a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericMetricEntityDecompactionStreamReader.java
 
b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericMetricEntityDecompactionStreamReader.java
index b1dd64c..1cf3905 100755
--- 
a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericMetricEntityDecompactionStreamReader.java
+++ 
b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/GenericMetricEntityDecompactionStreamReader.java
@@ -47,8 +47,8 @@ public class GenericMetricEntityDecompactionStreamReader 
extends StreamReader im
                ed = 
EntityDefinitionManager.getEntityByServiceName(serviceName);
                checkIsMetric(ed);
                reader = new GenericEntityStreamReader(serviceName, condition, 
metricName);
-               start = 
DateTimeUtil.humanDateToSeconds(condition.getStartTime())*1000;
-               end = 
DateTimeUtil.humanDateToSeconds(condition.getEndTime())*1000;
+               start = condition.getStartTime();
+               end = condition.getEndTime();
        }
        
        private void checkIsMetric(EntityDefinition ed){

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/dc9fe0b4/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/SearchCondition.java
----------------------------------------------------------------------
diff --git 
a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/SearchCondition.java
 
b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/SearchCondition.java
index fada0e2..68db2c4 100755
--- 
a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/SearchCondition.java
+++ 
b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/entity/SearchCondition.java
@@ -34,8 +34,8 @@ import java.util.Map;
  * 7. pagination: pageSize and startRowkey
  */
 public class SearchCondition{
-       private String startTime;
-       private String endTime;
+       private long startTime;
+       private long endTime;
        private Filter filter;
        private List<String> outputFields;
        private boolean outputAll;
@@ -113,16 +113,16 @@ public class SearchCondition{
        public void setOutputFields(List<String> outputFields) {
                this.outputFields = outputFields;
        }
-       public String getStartTime() {
+       public long getStartTime() {
                return startTime;
        }
-       public void setStartTime(String startTime) {
+       public void setStartTime(long startTime) {
                this.startTime = startTime;
        }
-       public String getEndTime() {
+       public long getEndTime() {
                return endTime;
        }
-       public void setEndTime(String endTime) {
+       public void setEndTime(long endTime) {
                this.endTime = endTime;
        }
        public List<String> getPartitionValues() {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/dc9fe0b4/eagle-core/eagle-query/eagle-query-base/src/test/java/org/apache/eagle/query/TestHBaseLogReader2.java
----------------------------------------------------------------------
diff --git 
a/eagle-core/eagle-query/eagle-query-base/src/test/java/org/apache/eagle/query/TestHBaseLogReader2.java
 
b/eagle-core/eagle-query/eagle-query-base/src/test/java/org/apache/eagle/query/TestHBaseLogReader2.java
index e3db5c0..6513452 100755
--- 
a/eagle-core/eagle-query/eagle-query-base/src/test/java/org/apache/eagle/query/TestHBaseLogReader2.java
+++ 
b/eagle-core/eagle-query/eagle-query-base/src/test/java/org/apache/eagle/query/TestHBaseLogReader2.java
@@ -24,7 +24,6 @@ import org.apache.eagle.log.entity.SearchCondition;
 import org.apache.eagle.log.entity.meta.EntityDefinition;
 import org.apache.eagle.log.entity.meta.EntityDefinitionManager;
 import org.apache.eagle.log.entity.test.TestTimeSeriesAPIEntity;
-import org.apache.eagle.query.ListQueryCompiler;
 import org.apache.eagle.service.hbase.EmbeddedHbase;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.junit.Assert;
@@ -32,12 +31,7 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.IOException;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
+import java.util.*;
 
 public class TestHBaseLogReader2 {
        private final static Logger LOG = 
LoggerFactory.getLogger(TestHBaseLogReader2.class);
@@ -80,8 +74,8 @@ public class TestHBaseLogReader2 {
                writer.write(entities);
 
                // for timezone difference between UTC & localtime, enlarge the 
search range
-               long queryStartTimestamp = timestamp1-24*60*60*1000;
-               long queryEndTimestamp = timestamp1+24*60*60*1000;
+               long queryStartTimestamp = timestamp1 - DateTimeUtil.ONEDAY;
+               long queryEndTimestamp = timestamp1 + DateTimeUtil.ONEDAY;
                LOG.info("Query start timestamp:" + queryStartTimestamp);
                LOG.info("Query end  timestamp:" + queryEndTimestamp);
 
@@ -100,8 +94,8 @@ public class TestHBaseLogReader2 {
 
                condition.setStartRowkey(null);
                condition.setPageSize(Integer.MAX_VALUE);
-               
condition.setStartTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(0));
-               
condition.setEndTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(queryEndTimestamp));
+               condition.setStartTime(0);
+               condition.setEndTime(queryEndTimestamp);
 
                GenericEntityBatchReader reader = new 
GenericEntityBatchReader(serviceName, condition);
                List<TestTimeSeriesAPIEntity> list = reader.read();
@@ -111,18 +105,18 @@ public class TestHBaseLogReader2 {
                Assert.assertEquals("field7", list.get(0).getField7());
 
                // for timezone difference between UTC & localtime, enlarge the 
search range
-               queryStartTimestamp = timestamp1-24*60*60*1000;
-               queryEndTimestamp = timestamp2+24*60*60*1000;  // eagle 
timestamp is rounded to seconds
-               
condition.setStartTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(queryStartTimestamp));
-               
condition.setEndTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(queryEndTimestamp));
+               queryStartTimestamp = timestamp1 - DateTimeUtil.ONEDAY;
+               queryEndTimestamp = timestamp2 + DateTimeUtil.ONEDAY;  // eagle 
timestamp is rounded to seconds
+               condition.setStartTime(queryStartTimestamp);
+               condition.setEndTime(queryEndTimestamp);
                reader = new GenericEntityBatchReader(serviceName, condition);
                list = reader.read();
                Assert.assertEquals(2, list.size());
 
                queryStartTimestamp = timestamp1;
                queryEndTimestamp = timestamp1;  // eagle timestamp is rounded 
to seconds
-               
condition.setStartTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(queryStartTimestamp));
-               
condition.setEndTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(queryEndTimestamp));
+               condition.setStartTime(queryStartTimestamp);
+               condition.setEndTime(queryEndTimestamp);
                reader = new GenericEntityBatchReader(serviceName, condition);
                list = reader.read();
                Assert.assertEquals(0, list.size());

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/dc9fe0b4/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/common/SplitFullScanEntityReader.java
----------------------------------------------------------------------
diff --git 
a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/common/SplitFullScanEntityReader.java
 
b/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/common/SplitFullScanEntityReader.java
index ae9ecef..f6009b5 100755
--- 
a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/common/SplitFullScanEntityReader.java
+++ 
b/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/common/SplitFullScanEntityReader.java
@@ -141,8 +141,8 @@ public class SplitFullScanEntityReader<ENTITY extends 
TaggedLogAPIEntity> {
                        final SearchCondition condition = new SearchCondition();
                        final String slotStartTimeString = 
DateTimeUtil.secondsToHumanDate(slotStartTime / 1000);
                        final String slotEndTimeString = 
DateTimeUtil.secondsToHumanDate(slotEndTime / 1000);
-                       condition.setStartTime(slotStartTimeString);
-                       condition.setEndTime(slotEndTimeString);
+                       condition.setStartTime(slotStartTime);
+                       condition.setEndTime(slotEndTime);
                        
                        condition.setFilter(comp.filter());
                        condition.setQueryExpression(comp.getQueryExpression());

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/dc9fe0b4/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/ListQueryResource.java
----------------------------------------------------------------------
diff --git 
a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/ListQueryResource.java
 
b/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/ListQueryResource.java
index b14dc22..eb05bf5 100755
--- 
a/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/ListQueryResource.java
+++ 
b/eagle-core/eagle-query/eagle-service-base/src/main/java/org/apache/eagle/service/generic/ListQueryResource.java
@@ -117,8 +117,8 @@ public class ListQueryResource {
                        EntityDefinition ed = 
EntityDefinitionManager.getEntityByServiceName(serviceName);
                        if(ed.isTimeSeries()){
                                // TODO check timestamp exists for timeseries 
or topology data
-                               condition.setStartTime(startTime);
-                               condition.setEndTime(endTime);
+                               
condition.setStartTime(DateTimeUtil.parseTimeStrToMilliseconds(startTime));
+                               
condition.setEndTime(DateTimeUtil.parseTimeStrToMilliseconds(endTime));
                        }
 
                        // 4. Set HBase start scanning rowkey if given
@@ -240,8 +240,8 @@ public class ListQueryResource {
                        EntityDefinition ed = 
EntityDefinitionManager.getEntityByServiceName(serviceName);
                        if(ed.isTimeSeries()){
                                // TODO check timestamp exists for timeseries 
or topology data
-                               condition.setStartTime(startTime);
-                               condition.setEndTime(endTime);
+                               
condition.setStartTime(DateTimeUtil.parseTimeStrToMilliseconds(startTime));
+                               
condition.setEndTime(DateTimeUtil.parseTimeStrToMilliseconds(endTime));
                        }
                        condition.setOutputVerbose(verbose==null || verbose );
                        condition.setOutputAlias(comp.getOutputAlias());
@@ -399,7 +399,7 @@ public class ListQueryResource {
                                        LOG.info("Output: " + 
StringUtils.join(condition.getOutputFields(), ", "));
                                }
                                TimeSeriesAggregator tsAgg = new 
TimeSeriesAggregator(groupbyFields, comp.aggregateFunctionTypes(), 
aggregateFields,
-                                               
DateTimeUtil.humanDateToDate(condition.getStartTime()).getTime(), 
DateTimeUtil.humanDateToDate(condition.getEndTime()).getTime(), 
intervalmin*60*1000);
+                                               condition.getStartTime(), 
condition.getEndTime(), intervalmin*60*1000);
                                if(parallel <= 0){
                                        reader.register(tsAgg);
                                }else{

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/dc9fe0b4/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/operation/CompiledQuery.java
----------------------------------------------------------------------
diff --git 
a/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/operation/CompiledQuery.java
 
b/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/operation/CompiledQuery.java
index e3368ab..9ec5751 100644
--- 
a/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/operation/CompiledQuery.java
+++ 
b/eagle-core/eagle-query/eagle-storage-base/src/main/java/org/apache/eagle/storage/operation/CompiledQuery.java
@@ -216,24 +216,20 @@ public class CompiledQuery {
             // TODO check Time exists for timeseries or topology data
             long endTimeMillis = System.currentTimeMillis();
             long startTimeMills = endTimeMillis - 30 * DateTimeUtil.ONEDAY;
-            String endTime = 
DateTimeUtil.millisecondsToHumanDateWithSeconds(endTimeMillis);
-            String startTime = 
DateTimeUtil.millisecondsToHumanDateWithSeconds(startTimeMills);
 
             if(this.rawQuery.getStartTime() != null && 
this.rawQuery.getEndTime() != null) {
-                endTime = this.rawQuery.getEndTime();
-                startTime = this.rawQuery.getStartTime();
-                endTimeMillis = DateTimeUtil.humanDateToSeconds(endTime) * 
1000;
-                startTimeMills = DateTimeUtil.humanDateToSeconds(startTime) * 
1000;
+                endTimeMillis = 
DateTimeUtil.parseTimeStrToMilliseconds(rawQuery.getEndTime());
+                startTimeMills = 
DateTimeUtil.parseTimeStrToMilliseconds(rawQuery.getStartTime());
             } else {
                 LOG.warn("startTime or endTime is not given, use 
[currentSystemTime - 30 days, currentSystemTime]");
             }
-            this.searchCondition.setStartTime(startTime);
-            this.searchCondition.setEndTime(endTime);
+            this.searchCondition.setStartTime(startTimeMills);
+            this.searchCondition.setEndTime(endTimeMillis);
             this.setStartTime(startTimeMills);
             this.setEndTime(endTimeMillis);
         }else{
-            this.searchCondition.setStartTime("0");
-            this.searchCondition.setEndTime("1");
+            this.searchCondition.setStartTime(0);
+            this.searchCondition.setEndTime(1);
             this.setStartTime(0);
             this.setEndTime(1);
         }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/dc9fe0b4/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/query/aggregate/GenericCoprocessorAggregateQuery.java
----------------------------------------------------------------------
diff --git 
a/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/query/aggregate/GenericCoprocessorAggregateQuery.java
 
b/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/query/aggregate/GenericCoprocessorAggregateQuery.java
index 85044ec..b6242c8 100644
--- 
a/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/query/aggregate/GenericCoprocessorAggregateQuery.java
+++ 
b/eagle-core/eagle-query/eagle-storage-hbase/src/main/java/org/apache/eagle/storage/hbase/query/aggregate/GenericCoprocessorAggregateQuery.java
@@ -162,8 +162,8 @@ public class GenericCoprocessorAggregateQuery implements 
GenericQuery {
         }
         // Process the time range if needed
         if (entityDef.isTimeSeries()) {
-            start = 
DateTimeUtil.humanDateToDate(searchCondition.getStartTime());
-            end = DateTimeUtil.humanDateToDate(searchCondition.getEndTime());
+            start = new Date(searchCondition.getStartTime());
+            end = new Date(searchCondition.getEndTime());
         } else {
             start = 
DateTimeUtil.humanDateToDate(EntityConstants.FIXED_READ_START_HUMANTIME);
             end = 
DateTimeUtil.humanDateToDate(EntityConstants.FIXED_READ_END_HUMANTIME);
@@ -278,8 +278,8 @@ public class GenericCoprocessorAggregateQuery implements 
GenericQuery {
             super(reader, query);
             try {
                 if (entityDef.isTimeSeries()) {
-                    this.start = 
DateTimeUtil.humanDateToDate(searchCondition.getStartTime());
-                    this.end = 
DateTimeUtil.humanDateToDate(searchCondition.getEndTime());
+                    this.start = new Date(searchCondition.getStartTime());
+                    this.end = new Date(searchCondition.getEndTime());
                 } else {
                     start = 
DateTimeUtil.humanDateToDate(EntityConstants.FIXED_READ_START_HUMANTIME);
                     end = 
DateTimeUtil.humanDateToDate(EntityConstants.FIXED_READ_END_HUMANTIME);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/dc9fe0b4/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 934929c..068fe0b 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
@@ -174,9 +174,11 @@ public class GenericInMemoryAggregateQuery implements 
GenericQuery {
                 reader = new 
GenericMetricEntityDecompactionStreamReader(this.prefix, searchCondition);
             }
             TimeSeriesAggregator tsAgg = new 
TimeSeriesAggregator(groupbyFields,
-                aggregateCondition.getAggregateFunctionTypes(), 
aggregateFields,
-                    
DateTimeUtil.humanDateToDate(searchCondition.getStartTime()).getTime(),
-                
DateTimeUtil.humanDateToDate(searchCondition.getEndTime()).getTime(), 
aggregateCondition.getIntervalMS());
+                    aggregateCondition.getAggregateFunctionTypes(),
+                    aggregateFields,
+                    searchCondition.getStartTime(),
+                    searchCondition.getEndTime(),
+                    aggregateCondition.getIntervalMS());
             reader.register(tsAgg);
 
             // for sorting

Reply via email to