You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ca...@apache.org on 2023/07/05 15:18:28 UTC
[iotdb] branch lmh/ABDwithView updated: fix last query it
This is an automated email from the ASF dual-hosted git repository.
caogaofei pushed a commit to branch lmh/ABDwithView
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/lmh/ABDwithView by this push:
new 7dfccb936c9 fix last query it
7dfccb936c9 is described below
commit 7dfccb936c95e71eced185583640cb65d904d4c4
Author: Beyyes <cg...@foxmail.com>
AuthorDate: Wed Jul 5 23:18:15 2023 +0800
fix last query it
---
.../view/IoTDBAlignByDeviceWithViewIT.java | 31 +++++++++++++---------
1 file changed, 19 insertions(+), 12 deletions(-)
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/view/IoTDBAlignByDeviceWithViewIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/view/IoTDBAlignByDeviceWithViewIT.java
index 6a7085763ef..8b42ddb9d9e 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/view/IoTDBAlignByDeviceWithViewIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/view/IoTDBAlignByDeviceWithViewIT.java
@@ -45,6 +45,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
@RunWith(IoTDBTestRunner.class)
@@ -152,22 +153,28 @@ public class IoTDBAlignByDeviceWithViewIT {
@Test
public void testLastQuery() {
- String[] expectedRetArray =
- new String[] {
- "23,root.sg1.d1.s1,230000.0,FLOAT",
- "23,root.sg1.d3.s1,230000.0,FLOAT",
- "20,root.sg1.d2.s1,20.0,FLOAT",
- };
-
try (Connection connection = EnvFactory.getEnv().getConnection();
Statement statement = connection.createStatement()) {
try (ResultSet resultSet = statement.executeQuery("SELECT last s1 FROM root.sg1.**")) {
- checkResult(
- resultSet,
- expectedRetArray,
- "Time,Timeseries,Value,DataType",
- new int[] {Types.TIMESTAMP, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR});
+
+ while (resultSet.next()) {
+ String time = resultSet.getString(1);
+ String name = resultSet.getString(2);
+ String value = resultSet.getString(3);
+ if ("root.sg1.d1.s1".equalsIgnoreCase(name)) {
+ assertEquals("23", time);
+ assertEquals("230000.0", value);
+ } else if ("root.sg1.d2.s1".equalsIgnoreCase(name)) {
+ assertEquals("20", time);
+ assertEquals("20.0", value);
+ } else if ("root.sg1.d3.s1".equalsIgnoreCase(name)) {
+ assertEquals("23", time);
+ assertEquals("230000.0", value);
+ } else {
+ fail("Unexpected series name: " + name);
+ }
+ }
}
} catch (Exception e) {
e.printStackTrace();