diff --git a/iotdb-1.1/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb110/IoTDB.java b/iotdb-1.1/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb110/IoTDB.java index b1bae6a4c..42f121ce5 100644 --- a/iotdb-1.1/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb110/IoTDB.java +++ b/iotdb-1.1/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb110/IoTDB.java @@ -659,16 +659,8 @@ private String getValueRangeQuerySql(ValueRangeQuery valueRangeQuery) { private String getValueFilterClause(List deviceSchemas, int valueThreshold) { StringBuilder builder = new StringBuilder(); - for (DeviceSchema deviceSchema : deviceSchemas) { - for (Sensor sensor : deviceSchema.getSensors()) { - builder - .append(" AND ") - .append(getDevicePath(deviceSchema)) - .append(".") - .append(sensor.getName()) - .append(" > ") - .append(valueThreshold); - } + for (Sensor sensor : deviceSchemas.get(0).getSensors()) { + builder.append(" AND ").append(sensor.getName()).append(" > ").append(valueThreshold); } return builder.toString(); } diff --git a/tdengine-3.0/src/main/java/cn/edu/tsinghua/iot/benchmark/tdengine3/TDengine.java b/tdengine-3.0/src/main/java/cn/edu/tsinghua/iot/benchmark/tdengine3/TDengine.java index 304414273..5960174d7 100644 --- a/tdengine-3.0/src/main/java/cn/edu/tsinghua/iot/benchmark/tdengine3/TDengine.java +++ b/tdengine-3.0/src/main/java/cn/edu/tsinghua/iot/benchmark/tdengine3/TDengine.java @@ -508,12 +508,15 @@ private static String addWhereClause( return sql; } StringBuilder sqlBuilder = new StringBuilder(sql); + sqlBuilder.append(WHERE); + if (timeRangeQuery != null) { String startTime = "" + timeRangeQuery.getStartTimestamp(); String endTime = "" + timeRangeQuery.getEndTimestamp(); sqlBuilder.append(" time >= ").append(startTime).append(" AND time <= ").append(endTime); } + if (valueRangeFilter != null) { if (!sqlBuilder.toString().endsWith(WHERE)) { sqlBuilder.append(" AND "); @@ -524,6 +527,7 @@ private static String addWhereClause( } sqlBuilder.delete(sqlBuilder.length() - 4, sqlBuilder.length()); } + if (!alignByDeviceTableNameFilter.isEmpty()) { if (!sqlBuilder.toString().endsWith(WHERE)) { sqlBuilder.append(" AND "); @@ -535,6 +539,7 @@ private static String addWhereClause( sqlBuilder.deleteCharAt(sqlBuilder.length() - 1); sqlBuilder.append(')'); } + return sqlBuilder.toString(); }