Skip to content

Commit

Permalink
test tdengion, good
Browse files Browse the repository at this point in the history
  • Loading branch information
liyuheng55555 committed Dec 29, 2023
1 parent a154d48 commit 67cbd2f
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package cn.edu.tsinghua.iot.benchmark.tdengine3;

import cn.edu.tsinghua.iot.benchmark.client.operation.OperationController;
import cn.edu.tsinghua.iot.benchmark.conf.Config;
import cn.edu.tsinghua.iot.benchmark.conf.ConfigDescriptor;
import cn.edu.tsinghua.iot.benchmark.entity.Batch.IBatch;
Expand Down Expand Up @@ -180,6 +181,7 @@ public Double registerSchema(List<DeviceSchema> schemaList) throws TsdbException

private synchronized void initOnlyOnce()
throws TsdbException, BrokenBarrierException, InterruptedException {
new OperationController(1).getNextOperationType();
if (!isInit.getAndSet(true)) {
try (Statement statement = connection.createStatement()) {
LOGGER.info("Create Database: {}", CREATE_DATABASE);
Expand Down Expand Up @@ -504,23 +506,24 @@ private static String addWhereClause(
return sql;
}
StringBuilder sqlBuilder = new StringBuilder(sql);
sqlBuilder.append(" WHERE");
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")) {
if (!sqlBuilder.toString().endsWith("WHERE ")) {
sqlBuilder.append(" AND ");
}
double valueThreshold = valueRangeFilter.getMinValue();
for (Sensor sensor : valueRangeFilter.getSensors()) {
sqlBuilder.append(sensor.getName()).append(" > ").append(valueThreshold).append(" AND ");
}
sqlBuilder.delete(sqlBuilder.length() - 4, sqlBuilder.length());
}
if (alignByDeviceTableNameFilter != null) {
if (!sqlBuilder.toString().endsWith("WHERE")) {
if (!sqlBuilder.toString().endsWith("WHERE ")) {
sqlBuilder.append(" AND ");
}
sqlBuilder.append(" tbname in (");
Expand Down

0 comments on commit 67cbd2f

Please sign in to comment.