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/12/24 02:34:38 UTC
[iotdb] branch groupbylevelstar created (now 911c335)
This is an automated email from the ASF dual-hosted git repository.
xiangweiwei pushed a change to branch groupbylevelstar
in repository https://gitbox.apache.org/repos/asf/iotdb.git.
at 911c335 Support double star ** in group by level
This branch includes the following new commits:
new 911c335 Support double star ** in group by level
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: Support double star ** in group by level
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiangweiwei pushed a commit to branch groupbylevelstar
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 911c335a119817a438e69e56f63e06a2d15669d7
Author: Alima777 <wx...@gmail.com>
AuthorDate: Fri Dec 24 10:33:44 2021 +0800
Support double star ** in group by level
---
.../integration/aggregation/IoTDBAggregationByLevelIT.java | 12 +++++++++++-
.../integration/aligned/IoTDBAggregationGroupByLevelIT.java | 12 ++++++++++--
.../apache/iotdb/db/engine/memtable/AbstractMemTable.java | 1 +
.../iotdb/db/query/expression/unary/FunctionExpression.java | 3 ++-
4 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/integration/src/test/java/org/apache/iotdb/db/integration/aggregation/IoTDBAggregationByLevelIT.java b/integration/src/test/java/org/apache/iotdb/db/integration/aggregation/IoTDBAggregationByLevelIT.java
index 1b5b40c..a2a3697 100644
--- a/integration/src/test/java/org/apache/iotdb/db/integration/aggregation/IoTDBAggregationByLevelIT.java
+++ b/integration/src/test/java/org/apache/iotdb/db/integration/aggregation/IoTDBAggregationByLevelIT.java
@@ -276,7 +276,7 @@ public class IoTDBAggregationByLevelIT {
@Test
public void countStarGroupByLevelTest() throws Exception {
- String[] retArray = new String[] {"17", "8"};
+ String[] retArray = new String[] {"17", "17", "8"};
try (Connection connection = EnvFactory.getEnv().getConnection();
Statement statement = connection.createStatement()) {
statement.execute("select count(*) from root.*.* GROUP BY level=0");
@@ -290,6 +290,16 @@ public class IoTDBAggregationByLevelIT {
}
}
+ statement.execute("select count(**) from root GROUP BY level=0");
+
+ try (ResultSet resultSet = statement.getResultSet()) {
+ while (resultSet.next()) {
+ String ans = resultSet.getString(TestConstant.count("root.*.*.*"));
+ Assert.assertEquals(retArray[cnt], ans);
+ cnt++;
+ }
+ }
+
statement.execute("select count(status) from root.*.* GROUP BY level=0");
try (ResultSet resultSet = statement.getResultSet()) {
diff --git a/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBAggregationGroupByLevelIT.java b/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBAggregationGroupByLevelIT.java
index a510beb..5c8d743 100644
--- a/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBAggregationGroupByLevelIT.java
+++ b/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBAggregationGroupByLevelIT.java
@@ -31,14 +31,22 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import java.sql.*;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Statement;
import java.util.HashMap;
import java.util.Map;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
@Category({LocalStandaloneTest.class})
public class IoTDBAggregationGroupByLevelIT {
+
private static final double DELTA = 1e-6;
private static final double NULL = Double.MIN_VALUE;
protected static boolean enableSeqSpaceCompaction;
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/memtable/AbstractMemTable.java b/server/src/main/java/org/apache/iotdb/db/engine/memtable/AbstractMemTable.java
index ac70f07..9b45ed3 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/memtable/AbstractMemTable.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/memtable/AbstractMemTable.java
@@ -44,6 +44,7 @@ import java.util.Map.Entry;
public abstract class AbstractMemTable implements IMemTable {
+ /** DeviceId -> chunkGroup(MeasurementId -> chunk) */
private final Map<String, IWritableMemChunkGroup> memTableMap;
/**
* The initial value is true because we want calculate the text data size when recover memTable!!
diff --git a/server/src/main/java/org/apache/iotdb/db/query/expression/unary/FunctionExpression.java b/server/src/main/java/org/apache/iotdb/db/query/expression/unary/FunctionExpression.java
index cb18570..39c1267 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/expression/unary/FunctionExpression.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/expression/unary/FunctionExpression.java
@@ -125,7 +125,8 @@ public class FunctionExpression extends Expression {
public boolean isCountStar() {
return getPaths().size() == 1
- && paths.get(0).getTailNode().equals(IoTDBConstant.ONE_LEVEL_PATH_WILDCARD)
+ && (paths.get(0).getTailNode().equals(IoTDBConstant.ONE_LEVEL_PATH_WILDCARD)
+ || paths.get(0).getTailNode().equals(IoTDBConstant.MULTI_LEVEL_PATH_WILDCARD))
&& functionName.equals(IoTDBConstant.COLUMN_COUNT);
}