You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2021/08/30 06:43:03 UTC
[iotdb] branch master updated: [IOTDB-1592] BugFix: SLimit Not
effective in align by device (#3846)
This is an automated email from the ASF dual-hosted git repository.
xiangweiwei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 33ce2b7 [IOTDB-1592] BugFix: SLimit Not effective in align by device (#3846)
33ce2b7 is described below
commit 33ce2b78ade67899287a83a1d9111461396d39b9
Author: Hang Ji <55...@users.noreply.github.com>
AuthorDate: Mon Aug 30 14:42:38 2021 +0800
[IOTDB-1592] BugFix: SLimit Not effective in align by device (#3846)
Co-authored-by: Xiangwei Wei <34...@users.noreply.github.com>
---
.../iotdb/db/qp/logical/crud/QueryOperator.java | 9 ++---
.../iotdb/db/integration/IoTDBAlignByDeviceIT.java | 38 ++++++++++++----------
2 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/QueryOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/QueryOperator.java
index 6ba73bd..d3dff46 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/QueryOperator.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/QueryOperator.java
@@ -312,9 +312,9 @@ public class QueryOperator extends Operator {
measurements.addAll(measurementSetOfGivenSuffix);
}
- convertSpecialClauseValues(alignByDevicePlan, measurements);
+ List<String> trimMeasurements = convertSpecialClauseValues(alignByDevicePlan, measurements);
// assigns to alignByDevicePlan
- alignByDevicePlan.setMeasurements(measurements);
+ alignByDevicePlan.setMeasurements(trimMeasurements);
alignByDevicePlan.setMeasurementInfoMap(measurementInfoMap);
alignByDevicePlan.setDevices(devices);
alignByDevicePlan.setPaths(paths);
@@ -338,15 +338,16 @@ public class QueryOperator extends Operator {
}
}
- private void convertSpecialClauseValues(QueryPlan queryPlan, List<String> measurements)
+ private List<String> convertSpecialClauseValues(QueryPlan queryPlan, List<String> measurements)
throws QueryProcessException {
convertSpecialClauseValues(queryPlan);
// sLimit trim on the measurementColumnList
if (specialClauseComponent.hasSlimit()) {
int seriesSLimit = specialClauseComponent.getSeriesLimit();
int seriesOffset = specialClauseComponent.getSeriesOffset();
- slimitTrimColumn(measurements, seriesSLimit, seriesOffset);
+ return slimitTrimColumn(measurements, seriesSLimit, seriesOffset);
}
+ return measurements;
}
private List<PartialPath> removeStarsInDeviceWithUnique(List<PartialPath> paths)
diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAlignByDeviceIT.java b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAlignByDeviceIT.java
index 40a2932..c049a7e 100644
--- a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAlignByDeviceIT.java
+++ b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAlignByDeviceIT.java
@@ -327,20 +327,22 @@ public class IoTDBAlignByDeviceIT {
public void selectSlimitTest() throws ClassNotFoundException {
String[] retArray =
new String[] {
- "1,root.vehicle.d0,101,1101,",
- "2,root.vehicle.d0,10000,40000,",
- "50,root.vehicle.d0,10000,50000,",
- "100,root.vehicle.d0,99,199,",
- "101,root.vehicle.d0,99,199,",
- "102,root.vehicle.d0,80,180,",
- "103,root.vehicle.d0,99,199,",
- "104,root.vehicle.d0,90,190,",
- "105,root.vehicle.d0,99,199,",
- "106,root.vehicle.d0,99,null,",
- "1000,root.vehicle.d0,22222,55555,",
- "946684800000,root.vehicle.d0,null,100,",
- "1,root.vehicle.d1,999,null,",
- "1000,root.vehicle.d1,888,null,"
+ "1,root.vehicle.d0,1101,null,",
+ "2,root.vehicle.d0,40000,2.22,",
+ "3,root.vehicle.d0,null,3.33,",
+ "4,root.vehicle.d0,null,4.44,",
+ "50,root.vehicle.d0,50000,null,",
+ "100,root.vehicle.d0,199,null,",
+ "101,root.vehicle.d0,199,null,",
+ "102,root.vehicle.d0,180,10.0,",
+ "103,root.vehicle.d0,199,null,",
+ "104,root.vehicle.d0,190,null,",
+ "105,root.vehicle.d0,199,11.11,",
+ "106,root.vehicle.d0,null,null,",
+ "1000,root.vehicle.d0,55555,1000.11,",
+ "946684800000,root.vehicle.d0,100,null,",
+ "1,root.vehicle.d1,null,null,",
+ "1000,root.vehicle.d1,null,null,",
};
Class.forName(Config.JDBC_DRIVER_NAME);
@@ -350,7 +352,7 @@ public class IoTDBAlignByDeviceIT {
Statement statement = connection.createStatement()) {
boolean hasResultSet =
statement.execute(
- "select s0,s0,s1 from root.vehicle.* slimit 2 soffset 1 align by device");
+ "select s0,s1,s2 from root.vehicle.* slimit 2 soffset 1 align by device");
Assert.assertTrue(hasResultSet);
try (ResultSet resultSet = statement.getResultSet()) {
@@ -358,9 +360,9 @@ public class IoTDBAlignByDeviceIT {
List<Integer> actualIndexToExpectedIndexList =
checkHeader(
resultSetMetaData,
- "Time,Device,s0,s1",
+ "Time,Device,s1,s2",
new int[] {
- Types.TIMESTAMP, Types.VARCHAR, Types.INTEGER, Types.BIGINT,
+ Types.TIMESTAMP, Types.VARCHAR, Types.BIGINT, Types.FLOAT,
});
int cnt = 0;
@@ -377,7 +379,7 @@ public class IoTDBAlignByDeviceIT {
Assert.assertEquals(expectedBuilder.toString(), actualBuilder.toString());
cnt++;
}
- Assert.assertEquals(14, cnt);
+ Assert.assertEquals(16, cnt);
}
} catch (Exception e) {
e.printStackTrace();