From 963ab578ef841112309fbb2dc59e34bbbd33ccc9 Mon Sep 17 00:00:00 2001 From: Yangyuming <2822758820@qq.com> Date: Thu, 28 Nov 2024 16:14:01 +0800 Subject: [PATCH 1/2] Fix okPointNum statistics for table models. --- .../benchmark/iotdb200/DMLStrategy/SessionStrategy.java | 7 ++++++- .../benchmark/iotdb200/ModelStrategy/TableStrategy.java | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/DMLStrategy/SessionStrategy.java b/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/DMLStrategy/SessionStrategy.java index 36c200a47..5f6f69bed 100644 --- a/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/DMLStrategy/SessionStrategy.java +++ b/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/DMLStrategy/SessionStrategy.java @@ -31,6 +31,7 @@ import cn.edu.tsinghua.iot.benchmark.entity.DeviceSummary; import cn.edu.tsinghua.iot.benchmark.entity.Record; import cn.edu.tsinghua.iot.benchmark.entity.Sensor; +import cn.edu.tsinghua.iot.benchmark.entity.enums.SQLDialect; import cn.edu.tsinghua.iot.benchmark.entity.enums.SensorType; import cn.edu.tsinghua.iot.benchmark.exception.OperationFailException; import cn.edu.tsinghua.iot.benchmark.iotdb200.IoTDB; @@ -366,7 +367,11 @@ public long executeQueryAndGetStatusImpl( long resultPointNum = line.get(); if (!Operation.LATEST_POINT_QUERY.equals(operation)) { resultPointNum *= config.getQUERY_SENSOR_NUM(); - resultPointNum *= config.getQUERY_DEVICE_NUM(); + if (!config.getIoTDB_DIALECT_MODE().equals(SQLDialect.TABLE)) { + resultPointNum *= config.getQUERY_DEVICE_NUM(); + } + } else if (config.getIoTDB_DIALECT_MODE().equals(SQLDialect.TABLE)) { + resultPointNum *= config.getQUERY_SENSOR_NUM(); } queryResultPointNum.set(resultPointNum); }); diff --git a/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/ModelStrategy/TableStrategy.java b/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/ModelStrategy/TableStrategy.java index 3b542c2a4..81e02dd18 100644 --- a/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/ModelStrategy/TableStrategy.java +++ b/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/ModelStrategy/TableStrategy.java @@ -208,7 +208,7 @@ public String getGroupByQuerySQL(GroupByQuery groupByQuery, boolean addOrderBy) builder .append("SELECT") .append(" device_id,") - .append(" date_bin(") + .append(" date_bin_gapfill(") .append(groupByQuery.getGranularity()) .append("ms, ") .append("time), ") @@ -225,7 +225,7 @@ public String getGroupByQuerySQL(GroupByQuery groupByQuery, boolean addOrderBy) addDeviceIDColumnIfNecessary(groupByQuery.getDeviceSchema(), builder); // GROUP BY builder - .append(" group by device_id, date_bin(") + .append(" group by device_id, date_bin_gapfill(") .append(groupByQuery.getGranularity()) .append("ms, time)"); // ORDER BY From 0215a5db203c101e6de4f7548edb222209c67d4b Mon Sep 17 00:00:00 2001 From: Yangyuming <2822758820@qq.com> Date: Thu, 28 Nov 2024 18:45:44 +0800 Subject: [PATCH 2/2] fix okpointNum for table. --- .../benchmark/iotdb200/DMLStrategy/SessionStrategy.java | 9 +++++---- .../benchmark/iotdb200/ModelStrategy/TableStrategy.java | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/DMLStrategy/SessionStrategy.java b/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/DMLStrategy/SessionStrategy.java index 5f6f69bed..b7cca7737 100644 --- a/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/DMLStrategy/SessionStrategy.java +++ b/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/DMLStrategy/SessionStrategy.java @@ -365,13 +365,14 @@ public long executeQueryAndGetStatusImpl( isOk.set(false); } long resultPointNum = line.get(); - if (!Operation.LATEST_POINT_QUERY.equals(operation)) { + + if (config.getIoTDB_DIALECT_MODE().equals(SQLDialect.TABLE)) { resultPointNum *= config.getQUERY_SENSOR_NUM(); - if (!config.getIoTDB_DIALECT_MODE().equals(SQLDialect.TABLE)) { + } else { + if (!Operation.LATEST_POINT_QUERY.equals(operation)) { resultPointNum *= config.getQUERY_DEVICE_NUM(); + resultPointNum *= config.getQUERY_SENSOR_NUM(); } - } else if (config.getIoTDB_DIALECT_MODE().equals(SQLDialect.TABLE)) { - resultPointNum *= config.getQUERY_SENSOR_NUM(); } queryResultPointNum.set(resultPointNum); }); diff --git a/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/ModelStrategy/TableStrategy.java b/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/ModelStrategy/TableStrategy.java index 81e02dd18..3b542c2a4 100644 --- a/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/ModelStrategy/TableStrategy.java +++ b/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/ModelStrategy/TableStrategy.java @@ -208,7 +208,7 @@ public String getGroupByQuerySQL(GroupByQuery groupByQuery, boolean addOrderBy) builder .append("SELECT") .append(" device_id,") - .append(" date_bin_gapfill(") + .append(" date_bin(") .append(groupByQuery.getGranularity()) .append("ms, ") .append("time), ") @@ -225,7 +225,7 @@ public String getGroupByQuerySQL(GroupByQuery groupByQuery, boolean addOrderBy) addDeviceIDColumnIfNecessary(groupByQuery.getDeviceSchema(), builder); // GROUP BY builder - .append(" group by device_id, date_bin_gapfill(") + .append(" group by device_id, date_bin(") .append(groupByQuery.getGranularity()) .append("ms, time)"); // ORDER BY