From 04df3e279a2d51083567a6098b2d488566d6e118 Mon Sep 17 00:00:00 2001 From: Caideyipi <87789683+Caideyipi@users.noreply.github.com> Date: Fri, 10 Jan 2025 15:09:59 +0800 Subject: [PATCH] Fixed the un-renamed ID/MEASUREMENTs in some non-runnable ITs --- .../scalar/IoTDBFormatFunctionTableIT.java | 21 +- .../old/query/IoTDBNullValueFillTableIT.java | 327 ------------------ .../old/query/IoTDBSelectSchemaTableIT.java | 22 +- 3 files changed, 20 insertions(+), 350 deletions(-) delete mode 100644 integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNullValueFillTableIT.java diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBFormatFunctionTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBFormatFunctionTableIT.java index 35e20f7edec1..f9018b65d98b 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBFormatFunctionTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBFormatFunctionTableIT.java @@ -15,11 +15,17 @@ package org.apache.iotdb.relational.it.query.old.builtinfunction.scalar; import org.apache.iotdb.it.env.EnvFactory; +import org.apache.iotdb.it.framework.IoTDBTestRunner; +import org.apache.iotdb.itbase.category.TableClusterIT; +import org.apache.iotdb.itbase.category.TableLocalStandaloneIT; import org.apache.iotdb.itbase.env.BaseEnv; import org.junit.AfterClass; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; import java.sql.Connection; import java.sql.Statement; @@ -27,6 +33,9 @@ import static org.apache.iotdb.db.it.utils.TestUtils.tableAssertTestFail; import static org.apache.iotdb.db.it.utils.TestUtils.tableResultSetEqualTest; +@Ignore +@RunWith(IoTDBTestRunner.class) +@Category({TableLocalStandaloneIT.class, TableClusterIT.class}) public class IoTDBFormatFunctionTableIT { private static final String DATABASE_NAME = "db"; @@ -36,12 +45,12 @@ public class IoTDBFormatFunctionTableIT { // normal cases "CREATE DATABASE " + DATABASE_NAME, "USE " + DATABASE_NAME, - "CREATE TABLE number_table(device_id STRING ID, s1 INT32 MEASUREMENT, s2 INT64 MEASUREMENT, s3 FLOAT MEASUREMENT, s4 DOUBLE MEASUREMENT)", - "CREATE TABLE string_table(device_id STRING ID, s1 STRING MEASUREMENT, s2 TEXT MEASUREMENT)", - "CREATE TABLE boolean_table(device_id STRING ID, s1 BOOLEAN MEASUREMENT)", - "CREATE TABLE timestamp_table(device_id STRING ID, s1 TIMESTAMP MEASUREMENT)", - "CREATE TABLE date_table(device_id STRING ID, s1 DATE MEASUREMENT)", - "CREATE TABLE null_table(device_id STRING ID, s1 INT32 MEASUREMENT)", + "CREATE TABLE number_table(device_id STRING TAG, s1 INT32 FIELD, s2 INT64 FIELD, s3 FLOAT FIELD, s4 DOUBLE FIELD)", + "CREATE TABLE string_table(device_id STRING TAG, s1 STRING FIELD, s2 TEXT FIELD)", + "CREATE TABLE boolean_table(device_id STRING TAG, s1 BOOLEAN FIELD)", + "CREATE TABLE timestamp_table(device_id STRING TAG, s1 TIMESTAMP FIELD)", + "CREATE TABLE date_table(device_id STRING TAG, s1 DATE FIELD)", + "CREATE TABLE null_table(device_id STRING TAG, s1 INT32 FIELD)", // data for number series "INSERT INTO number_table(time, device_id, s1, s2, s3, s4) VALUES (10, 'd1', 1000000, 1000000, 3.1415926, 3.1415926)", "INSERT INTO number_table(time, device_id, s1, s2, s3, s4) VALUES (20, 'd1', 1, 1, 1234567.25, 1234567.25)", diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNullValueFillTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNullValueFillTableIT.java deleted file mode 100644 index a7ba0315d52b..000000000000 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBNullValueFillTableIT.java +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.relational.it.query.old.query; - -import org.apache.iotdb.it.env.EnvFactory; -import org.apache.iotdb.it.framework.IoTDBTestRunner; -import org.apache.iotdb.itbase.category.TableClusterIT; -import org.apache.iotdb.itbase.category.TableLocalStandaloneIT; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.junit.runner.RunWith; - -import static org.apache.iotdb.db.it.utils.TestUtils.prepareData; -import static org.apache.iotdb.db.it.utils.TestUtils.resultSetEqualTest; -import static org.apache.iotdb.db.it.utils.TestUtils.resultSetEqualWithDescOrderTest; - -@Ignore -@RunWith(IoTDBTestRunner.class) -@Category({TableLocalStandaloneIT.class, TableClusterIT.class}) -public class IoTDBNullValueFillTableIT { - private static final String DATABASE_NAME = "test"; - - /** - * [root.sg1.d1 (aligned)] - * - *
Time, s1[INT32], s2[INT64], s3[FLOAT], s4[DOUBLE], s5[BOOLEAN], s6[TEXT]
- * 1, null, 1, null, 1.0, null, t1
- * 2, 2, 2, 2.0, 2.0, true, t2
- * 3, 3, null, 3.0, null, false, null
- * 4, null, 4, null, 4.0, null, t4
- * 5, 5, 5, 5.0, 5.0, false, t5
- * 6, null, 6, null, 6.0, false, null
- * 7, null, null, null, null, null, null
- * 8, 8, 8, 8.0, 8.0, true, t8
- * 9, 9, null, 9.0, null, true, null
- *
- *
[root.sg1.d2 (non-aligned)] - * - *
Time, s1[INT32], s2[INT64], s3[FLOAT], s4[DOUBLE], s5[BOOLEAN], s6[TEXT]
- * 1, 1, null, 1.0, null, true, null
- * 2, 2, 2, 2.0, 2.0, true, t2
- * 3, null, 3, null, 3.0, null, t3
- * 4, 4, null, 4.0, null, false, null
- * 5, 5, 5, 5.0, 5.0, false, t5
- * 6, 6, null, 6.0, null, false, null
- * 7, null, null, null, null, null, null
- * 8, 8, 8, 8.0, 8.0, true, t8
- * 9, null, 9, null, 9.0, null, t9
- */
- private static final String[] sqls =
- new String[] {
- "CREATE DATABASE " + DATABASE_NAME,
- "USE " + DATABASE_NAME,
- "CREATE TABLE testNullFilter(device STRING ID, s1 INT32 MEASUREMENT, s2 BOOLEAN MEASUREMENT, s3 DOUBLE MEASUREMENT)",
- "create aligned timeseries root.sg1.d1(s1 INT32, s2 INT64, s3 FLOAT, s4 DOUBLE, s5 BOOLEAN, s6 TEXT)",
- "insert into root.sg1.d1(time, s2, s4, s6) aligned values(1, 1, 1.0, 't1')",
- "insert into root.sg1.d1(time, s1, s2, s3, s4, s5, s6) aligned values(2, 2, 2, 2.0, 2.0, true, 't2')",
- "insert into root.sg1.d1(time, s1, s3, s5) aligned values(3, 3, 3.0, false)",
- "insert into root.sg1.d1(time, s2, s4, s6) aligned values(4, 4, 4.0, 't4')",
- "insert into root.sg1.d1(time, s1, s2, s3, s4, s5, s6) aligned values(5, 5, 5, 5.0, 5.0, false, 't5')",
- "insert into root.sg1.d1(time, s2, s4, s6) aligned values(6, 6, 6.0, 't6')",
- "insert into root.sg1.d1(time, s1, s2, s3, s4, s5, s6) aligned values(8, 8, 8, 8.0, 8.0, true, 't8')",
- "insert into root.sg1.d1(time, s1, s3, s5) aligned values(9, 9, 9.0, true)",
- "create timeseries root.sg1.d2.s1 INT32",
- "create timeseries root.sg1.d2.s2 INT64",
- "create timeseries root.sg1.d2.s3 FLOAT",
- "create timeseries root.sg1.d2.s4 DOUBLE",
- "create timeseries root.sg1.d2.s5 BOOLEAN",
- "create timeseries root.sg1.d2.s6 TEXT",
- "insert into root.sg1.d2(time, s1, s3, s5) values(1, 1, 1.0, true)",
- "insert into root.sg1.d2(time, s1, s2, s3, s4, s5, s6) values(2, 2, 2, 2.0, 2.0, true, 't2')",
- "insert into root.sg1.d2(time, s2, s4, s6) values(3, 3, 3.0, 't3')",
- "insert into root.sg1.d2(time, s1, s3, s5) values(4, 4, 4.0, false)",
- "insert into root.sg1.d2(time, s1, s2, s3, s4, s5, s6) values(5, 5, 5, 5.0, 5.0, false, 't5')",
- "insert into root.sg1.d2(time, s1, s3, s5) values(6, 6, 6.0, false)",
- "insert into root.sg1.d2(time, s1, s2, s3, s4, s5, s6) values(8, 8, 8, 8.0, 8.0, true, 't8')",
- "insert into root.sg1.d2(time, s2, s4, s6) values(9, 9, 9.0, 't9')"
- };
-
- private final String[] expectedHeader =
- new String[] {
- "Time",
- "root.sg1.d1.s1",
- "root.sg1.d1.s2",
- "root.sg1.d1.s3",
- "root.sg1.d1.s4",
- "root.sg1.d1.s5",
- "root.sg1.d1.s6"
- };
-
- private final String[] expectedAlignByDeviceHeader =
- new String[] {"Time", "Device", "s1", "s2", "s3", "s4", "s5", "s6"};
-
- @BeforeClass
- public static void setUp() throws Exception {
- EnvFactory.getEnv().initClusterEnvironment();
- prepareData(sqls);
- }
-
- @AfterClass
- public static void tearDown() throws Exception {
- EnvFactory.getEnv().cleanClusterEnvironment();
- }
-
- @Test
- public void previousFillTest() {
- String[] retArray =
- new String[] {
- "1,null,1,null,1.0,null,t1,",
- "2,2,2,2.0,2.0,true,t2,",
- "3,3,2,3.0,2.0,false,t2,",
- "4,3,4,3.0,4.0,false,t4,",
- "5,5,5,5.0,5.0,false,t5,",
- "6,5,6,5.0,6.0,false,t6,",
- "8,8,8,8.0,8.0,true,t8,",
- "9,9,8,9.0,8.0,true,t8,"
- };
- resultSetEqualTest(
- "select s1, s2, s3, s4, s5, s6 from root.sg1.d1 fill(previous)", expectedHeader, retArray);
- }
-
- @Test
- public void previousDescFillTest() {
- String[] retArray =
- new String[] {
- "9,9,null,9.0,null,true,null,",
- "8,8,8,8.0,8.0,true,t8,",
- "6,8,6,8.0,6.0,true,t6,",
- "5,5,5,5.0,5.0,false,t5,",
- "4,5,4,5.0,4.0,false,t4,",
- "3,3,4,3.0,4.0,false,t4,",
- "2,2,2,2.0,2.0,true,t2,",
- "1,2,1,2.0,1.0,true,t1,"
- };
- resultSetEqualTest(
- "select s1, s2, s3, s4, s5, s6 from root.sg1.d1 fill(previous) order by time desc",
- expectedHeader,
- retArray);
- }
-
- @Test
- public void previousFillAlignByDeviceTest() {
- String[] retArray =
- new String[] {
- "1,root.sg1.d1,null,1,null,1.0,null,t1,",
- "2,root.sg1.d1,2,2,2.0,2.0,true,t2,",
- "3,root.sg1.d1,3,2,3.0,2.0,false,t2,",
- "4,root.sg1.d1,3,4,3.0,4.0,false,t4,",
- "5,root.sg1.d1,5,5,5.0,5.0,false,t5,",
- "6,root.sg1.d1,5,6,5.0,6.0,false,t6,",
- "8,root.sg1.d1,8,8,8.0,8.0,true,t8,",
- "9,root.sg1.d1,9,8,9.0,8.0,true,t8,",
- "1,root.sg1.d2,1,8,1.0,8.0,true,t8,",
- "2,root.sg1.d2,2,2,2.0,2.0,true,t2,",
- "3,root.sg1.d2,2,3,2.0,3.0,true,t3,",
- "4,root.sg1.d2,4,3,4.0,3.0,false,t3,",
- "5,root.sg1.d2,5,5,5.0,5.0,false,t5,",
- "6,root.sg1.d2,6,5,6.0,5.0,false,t5,",
- "8,root.sg1.d2,8,8,8.0,8.0,true,t8,",
- "9,root.sg1.d2,8,9,8.0,9.0,true,t9,"
- };
- resultSetEqualTest(
- "select s1, s2, s3, s4, s5, s6 from root.sg1.* fill(previous) align by device",
- expectedAlignByDeviceHeader,
- retArray);
- }
-
- @Test
- public void previousDescFillAlignByDeviceTest() {
- String[] retArray =
- new String[] {
- "9,root.sg1.d1,9,null,9.0,null,true,null,",
- "8,root.sg1.d1,8,8,8.0,8.0,true,t8,",
- "6,root.sg1.d1,8,6,8.0,6.0,true,t6,",
- "5,root.sg1.d1,5,5,5.0,5.0,false,t5,",
- "4,root.sg1.d1,5,4,5.0,4.0,false,t4,",
- "3,root.sg1.d1,3,4,3.0,4.0,false,t4,",
- "2,root.sg1.d1,2,2,2.0,2.0,true,t2,",
- "1,root.sg1.d1,2,1,2.0,1.0,true,t1,",
- "9,root.sg1.d2,2,9,2.0,9.0,true,t9,",
- "8,root.sg1.d2,8,8,8.0,8.0,true,t8,",
- "6,root.sg1.d2,6,8,6.0,8.0,false,t8,",
- "5,root.sg1.d2,5,5,5.0,5.0,false,t5,",
- "4,root.sg1.d2,4,5,4.0,5.0,false,t5,",
- "3,root.sg1.d2,4,3,4.0,3.0,false,t3,",
- "2,root.sg1.d2,2,2,2.0,2.0,true,t2,",
- "1,root.sg1.d2,1,2,1.0,2.0,true,t2,"
- };
- resultSetEqualTest(
- "select s1, s2, s3, s4, s5, s6 from root.sg1.* fill(previous) order by device,time desc align by device",
- expectedAlignByDeviceHeader,
- retArray);
- }
-
- @Test
- public void linearFillTest() {
- String[] retArray =
- new String[] {
- "1,null,1,null,1.0,null,t1,",
- "2,2,2,2.0,2.0,true,t2,",
- "3,3,3,3.0,3.0,false,null,",
- "4,4,4,4.0,4.0,null,t4,",
- "5,5,5,5.0,5.0,false,t5,",
- "6,6,6,6.0,6.0,null,t6,",
- "8,8,8,8.0,8.0,true,t8,",
- "9,9,null,9.0,null,true,null,"
- };
- resultSetEqualWithDescOrderTest(
- "select s1, s2, s3, s4, s5, s6 from root.sg1.d1 fill(linear)", expectedHeader, retArray);
- }
-
- @Test
- public void linearFillAlignByDeviceTest() {
- String[] retArray =
- new String[] {
- "1,root.sg1.d1,null,1,null,1.0,null,t1,",
- "2,root.sg1.d1,2,2,2.0,2.0,true,t2,",
- "3,root.sg1.d1,3,3,3.0,3.0,false,null,",
- "4,root.sg1.d1,4,4,4.0,4.0,null,t4,",
- "5,root.sg1.d1,5,5,5.0,5.0,false,t5,",
- "6,root.sg1.d1,6,6,6.0,6.0,null,t6,",
- "8,root.sg1.d1,8,8,8.0,8.0,true,t8,",
- "9,root.sg1.d1,9,9,9.0,9.0,true,null,",
- "1,root.sg1.d2,1,1,1.0,1.0,true,null,",
- "2,root.sg1.d2,2,2,2.0,2.0,true,t2,",
- "3,root.sg1.d2,3,3,3.0,3.0,null,t3,",
- "4,root.sg1.d2,4,4,4.0,4.0,false,null,",
- "5,root.sg1.d2,5,5,5.0,5.0,false,t5,",
- "6,root.sg1.d2,6,6,6.0,6.0,false,null,",
- "8,root.sg1.d2,8,8,8.0,8.0,true,t8,",
- "9,root.sg1.d2,null,9,null,9.0,null,t9,"
- };
- resultSetEqualTest(
- "select s1, s2, s3, s4, s5, s6 from root.sg1.* fill(linear) align by device",
- expectedAlignByDeviceHeader,
- retArray);
- }
-
- @Test
- public void intFillTest() {
- String[] retArray =
- new String[] {
- "1,1000,1,1000.0,1.0,null,t1,",
- "2,2,2,2.0,2.0,true,t2,",
- "3,3,1000,3.0,1000.0,false,1000,",
- "4,1000,4,1000.0,4.0,null,t4,",
- "5,5,5,5.0,5.0,false,t5,",
- "6,1000,6,1000.0,6.0,null,t6,",
- "8,8,8,8.0,8.0,true,t8,",
- "9,9,1000,9.0,1000.0,true,1000,"
- };
- resultSetEqualWithDescOrderTest(
- "select s1, s2, s3, s4, s5, s6 from root.sg1.d1 fill(1000)", expectedHeader, retArray);
- }
-
- @Test
- public void floatFillTest() {
- String[] retArray =
- new String[] {
- "1,null,1,3.14,1.0,null,t1,",
- "2,2,2,2.0,2.0,true,t2,",
- "3,3,null,3.0,3.14,false,3.14,",
- "4,null,4,3.14,4.0,null,t4,",
- "5,5,5,5.0,5.0,false,t5,",
- "6,null,6,3.14,6.0,null,t6,",
- "8,8,8,8.0,8.0,true,t8,",
- "9,9,null,9.0,3.14,true,3.14,"
- };
- resultSetEqualWithDescOrderTest(
- "select s1, s2, s3, s4, s5, s6 from root.sg1.d1 fill(3.14)", expectedHeader, retArray);
- }
-
- @Test
- public void booleanFillTest() {
- String[] retArray =
- new String[] {
- "1,null,1,null,1.0,true,t1,",
- "2,2,2,2.0,2.0,true,t2,",
- "3,3,null,3.0,null,false,true,",
- "4,null,4,null,4.0,true,t4,",
- "5,5,5,5.0,5.0,false,t5,",
- "6,null,6,null,6.0,true,t6,",
- "8,8,8,8.0,8.0,true,t8,",
- "9,9,null,9.0,null,true,true,"
- };
- resultSetEqualWithDescOrderTest(
- "select s1, s2, s3, s4, s5, s6 from root.sg1.d1 fill(true)", expectedHeader, retArray);
- }
-
- @Test
- public void textFillTest() {
- String[] retArray =
- new String[] {
- "1,null,1,null,1.0,null,t1,",
- "2,2,2,2.0,2.0,true,t2,",
- "3,3,null,3.0,null,false,t0,",
- "4,null,4,null,4.0,null,t4,",
- "5,5,5,5.0,5.0,false,t5,",
- "6,null,6,null,6.0,null,t6,",
- "8,8,8,8.0,8.0,true,t8,",
- "9,9,null,9.0,null,true,t0,"
- };
- resultSetEqualWithDescOrderTest(
- "select s1, s2, s3, s4, s5, s6 from root.sg1.d1 fill('t0')", expectedHeader, retArray);
- }
-}
diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBSelectSchemaTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBSelectSchemaTableIT.java
index aee30ec1de2b..e17f873e116b 100644
--- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBSelectSchemaTableIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/query/IoTDBSelectSchemaTableIT.java
@@ -27,7 +27,6 @@
import org.junit.AfterClass;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
@@ -49,7 +48,7 @@ public class IoTDBSelectSchemaTableIT {
new String[] {
"CREATE DATABASE " + DATABASE_NAME,
"USE " + DATABASE_NAME,
- "CREATE TABLE sg(device STRING ID, s1 INT32 MEASUREMENT, s2 INT64 MEASUREMENT, s3 DOUBLE MEASUREMENT)",
+ "CREATE TABLE sg(device STRING TAG, s1 INT32 FIELD, s2 INT64 FIELD, s3 DOUBLE FIELD)",
"insert into sg(time, device, s1, s2, s3) values (1, 'd1', 1, 2, 3.0)"
};
@@ -64,7 +63,6 @@ public static void tearDown() throws Exception {
EnvFactory.getEnv().cleanClusterEnvironment();
}
- @Ignore // TODO After sin supported
@Test
public void testSchemaExpression() {
String[] expressions = {
@@ -80,18 +78,9 @@ public void testSchemaExpression() {
"sin(s1)+s1",
"((s1+1)*2-1)%2+1.5+s2"
};
- String[] completeExpressions = {
- "s1+s2",
- "-s1+s2",
- "-(s1+s3)",
- "not(s1>s2)",
- "-(-s1)",
- "(s1+s2)*s3",
- "-2+s1",
- "not true or s1>0",
- "-(-1)+s1",
- "sin(s1)+s1",
- "((s1+1)*2-1)%2+1.5+s2",
+ String[] columnNames = {
+ "_col1", "_col2", "_col3", "_col4", "_col5", "_col6", "_col7", "_col8", "_col9", "_col10",
+ "_col11",
};
try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT);
Statement statement = connection.createStatement()) {
@@ -115,8 +104,7 @@ public void testSchemaExpression() {
assertEquals(1 + expressions.length, columnCount);
for (int i = 0; i < expressions.length; ++i) {
- assertEquals(
- completeExpressions[i], resultSet.getMetaData().getColumnName(i + 2).replace(" ", ""));
+ assertEquals(columnNames[i], resultSet.getMetaData().getColumnName(i + 2).replace(" ", ""));
}
} catch (SQLException throwable) {
fail(throwable.getMessage());