You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2021/12/01 02:56:54 UTC
[iotdb] branch master updated: [IOTDB-1233] Support create aligned time series containing only one measurement (#4499)
This is an automated email from the ASF dual-hosted git repository.
jackietien 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 54fd017 [IOTDB-1233] Support create aligned time series containing only one measurement (#4499)
54fd017 is described below
commit 54fd0174645e5c602cf3f363e9eb049f040031bf
Author: liuminghui233 <36...@users.noreply.github.com>
AuthorDate: Wed Dec 1 10:56:27 2021 +0800
[IOTDB-1233] Support create aligned time series containing only one measurement (#4499)
---
.../org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4 | 2 +-
.../IoTDBCreateAlignedTimeseriesIT.java | 35 +++++++++++++++++++++-
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4 b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
index e3d9449..a151bed 100644
--- a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
+++ b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
@@ -84,7 +84,7 @@ createTimeseries
alignedMeasurements
: LR_BRACKET nodeNameWithoutWildcard attributeClauses
- (COMMA nodeNameWithoutWildcard attributeClauses)+ RR_BRACKET
+ (COMMA nodeNameWithoutWildcard attributeClauses)* RR_BRACKET
;
// Create Schema Template
diff --git a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBCreateAlignedTimeseriesIT.java b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBCreateAlignedTimeseriesIT.java
index e4a6bd7..036cd68 100644
--- a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBCreateAlignedTimeseriesIT.java
+++ b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBCreateAlignedTimeseriesIT.java
@@ -23,7 +23,10 @@ import org.apache.iotdb.itbase.category.LocalStandaloneTest;
import org.apache.iotdb.jdbc.Config;
import org.apache.iotdb.jdbc.IoTDBSQLException;
-import org.junit.*;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
import org.junit.experimental.categories.Category;
import java.sql.Connection;
@@ -85,6 +88,36 @@ public class IoTDBCreateAlignedTimeseriesIT {
assertTimeseriesEquals(timeSeriesArray);
}
+ @Test
+ public void testCreateAlignedTimeseriesWithDeletion() throws Exception {
+ String[] timeSeriesArray =
+ new String[] {
+ "root.sg1.d1.vector1.s1,DOUBLE,PLAIN,SNAPPY", "root.sg1.d1.vector1.s2,INT64,RLE,SNAPPY"
+ };
+
+ statement.execute("SET STORAGE GROUP TO root.sg1");
+ try {
+ statement.execute(
+ "CREATE ALIGNED TIMESERIES root.sg1.d1.vector1(s1 FLOAT encoding=PLAIN compressor=UNCOMPRESSED,s2 INT64 encoding=RLE)");
+ statement.execute("DELETE TIMESERIES root.sg1.d1.vector1.s1");
+ statement.execute(
+ "CREATE ALIGNED TIMESERIES root.sg1.d1.vector1(s1 DOUBLE encoding=PLAIN compressor=SNAPPY)");
+ } catch (IoTDBSQLException e) {
+ e.printStackTrace();
+ }
+
+ // ensure that current storage group in cache is right.
+ assertTimeseriesEquals(timeSeriesArray);
+
+ statement.close();
+ connection.close();
+ EnvironmentUtils.stopDaemon();
+ setUp();
+
+ // ensure storage group in cache is right after recovering.
+ assertTimeseriesEquals(timeSeriesArray);
+ }
+
private void assertTimeseriesEquals(String[] timeSeriesArray) throws SQLException {
boolean hasResult = statement.execute("SHOW TIMESERIES");
Assert.assertTrue(hasResult);