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/01 04:05:07 UTC
[iotdb] branch beyyes/fix_plan_ut created (now 242805f52e1)
This is an automated email from the ASF dual-hosted git repository.
caogaofei pushed a change to branch beyyes/fix_plan_ut
in repository https://gitbox.apache.org/repos/asf/iotdb.git
at 242805f52e1 add test for analyze
This branch includes the following new commits:
new 242805f52e1 add test for analyze
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[iotdb] 01/01: add test for analyze
Posted by ca...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
caogaofei pushed a commit to branch beyyes/fix_plan_ut
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 242805f52e11c61720a5b48df429ec2fb70eaec7
Author: Beyyes <cg...@foxmail.com>
AuthorDate: Sat Jul 1 12:04:53 2023 +0800
add test for analyze
---
.../db/queryengine/plan/analyze/AnalyzeTest.java | 56 ++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeTest.java
index 17b6a6d3c13..45c72f48db8 100644
--- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeTest.java
+++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeTest.java
@@ -181,6 +181,29 @@ public class AnalyzeTest {
}
}
+ @Test
+ public void testLastQuery() {
+ String sql = "select count(s1 + s2), last_value(s2) from root.sg.d1 group by ([0, 100), 10ms);";
+ Analysis actualAnalysis = analyzeSQL(sql);
+ }
+
+ @Test
+ public void testGroupBy() {
+ // test group by level
+ String sql = "select count(s1), count(s2) from root.sg.d1 group by ([0, 100), 10ms), level=2 " +
+ "having count s2 > 1 offset 1 limit 1";
+ Analysis actualAnalysis = analyzeSQL(sql);
+
+ // test group by tag
+
+
+ // test group by + align by device
+
+ //
+ }
+
+
+
@Test
public void testAggregationQuery() {
String sql =
@@ -1023,6 +1046,39 @@ public class AnalyzeTest {
"alias 'a' can only be matched with one time series");
}
+ @Test
+ public void testShowTimeseries() {
+ String sql = "show timeseries";
+ Analysis actualAnalysis = analyzeSQL(sql);
+ assert actualAnalysis != null;
+ assertEquals(11, actualAnalysis.getRespDatasetHeader().getColumnHeaders().size());
+ assertEquals(new ColumnHeader("Timeseries", TSDataType.TEXT, null),
+ actualAnalysis.getRespDatasetHeader().getColumnHeaders().get(0));
+ }
+
+ @Test
+ public void testShowStorageGroup() {
+ String sql = "show storage group";
+ Analysis actualAnalysis = analyzeSQL(sql);
+ assert actualAnalysis != null;
+ assertEquals(5, actualAnalysis.getRespDatasetHeader().getColumnHeaders().size());
+ assertEquals(new ColumnHeader("Database", TSDataType.TEXT, null),
+ actualAnalysis.getRespDatasetHeader().getColumnHeaders().get(0));
+ }
+
+ @Test
+ public void testExplain() {
+ Analysis analysis = analyzeSQL("explain select s1 as a, s2 as b from root.sg.d2.a, root.sg.d2.b");
+ assert analysis != null;
+ Assert.assertEquals(
+ analysis.getRespDatasetHeader(),
+ new DatasetHeader(
+ Arrays.asList(
+ new ColumnHeader("root.sg.d2.a.s1", TSDataType.INT32, "a"),
+ new ColumnHeader("root.sg.d2.a.s2", TSDataType.DOUBLE, "b")),
+ false));
+ }
+
private void assertTestFail(String sql, String errMsg) {
try {
Statement statement =