|
@@ -60,14 +60,14 @@ public class TaosHistoryDao implements IHistoryDao {
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
sb.append("select avg(val),max(val),min(val) from ");
|
|
|
sb.append(taosConfig.getTableName(tsQuery.getTsPoint().getId()));
|
|
|
- sb.append(" where ts between").append(tsQuery.getStartTs());
|
|
|
+ sb.append(" where ts between ").append(tsQuery.getStartTs());
|
|
|
sb.append(" and ").append(tsQuery.getEndTs());
|
|
|
- sb.append(" interval(").append(tsQuery.getInterval()).append("s)");
|
|
|
+ //sb.append(" interval(").append(tsQuery.getInterval()).append("s)");
|
|
|
ResultSet rs = st.executeQuery(sb.toString());
|
|
|
while (rs.next()) {
|
|
|
- DoubleTsData avgData = new DoubleTsData(rs.getLong(1), (short) 1, rs.getDouble(2));
|
|
|
- DoubleTsData maxData = new DoubleTsData(rs.getLong(1), (short) 1, rs.getDouble(3));
|
|
|
- DoubleTsData minData = new DoubleTsData(rs.getLong(1), (short) 1, rs.getDouble(4));
|
|
|
+ DoubleTsData avgData = new DoubleTsData(tsQuery.getStartTs(), (short) 1, rs.getDouble(1));
|
|
|
+ DoubleTsData maxData = new DoubleTsData(tsQuery.getStartTs(), (short) 1, rs.getDouble(2));
|
|
|
+ DoubleTsData minData = new DoubleTsData(tsQuery.getStartTs(), (short) 1, rs.getDouble(3));
|
|
|
DoubleStatData statData = new DoubleStatData(avgData, maxData, minData);
|
|
|
result.add(statData);
|
|
|
}
|
|
@@ -227,11 +227,11 @@ public class TaosHistoryDao implements IHistoryDao {
|
|
|
sb.append(" and ").append(tsQuery.getEndTs());
|
|
|
} else if (tsQuery.getInterpolation() == Interpolation.SNAP) {
|
|
|
if (tsQuery.getDateArray() != null && tsQuery.getDateArray().length > 0) {
|
|
|
- sb.append("select interp(val) from ");
|
|
|
+ sb.append("select _irowts,interp(val) from ");
|
|
|
sb.append(taosConfig.getTableName(point));
|
|
|
- sb.append(" where ts between ").append(tsQuery.getStartTs());
|
|
|
- sb.append(" and ").append(tsQuery.getEndTs());
|
|
|
- sb.append(" every(").append(tsQuery.getInterval()).append("s) fill(prev)");
|
|
|
+ sb.append(" range(").append(tsQuery.getStartTs());
|
|
|
+ sb.append(",").append(tsQuery.getEndTs());
|
|
|
+ sb.append(") every(").append(tsQuery.getInterval()).append("s) fill(prev)");
|
|
|
} else {
|
|
|
throw new WisdomException("无效的查询条件!");
|
|
|
}
|