This is an automated email from the ASF dual-hosted git repository.

zyk pushed a commit to branch rel/1.2
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/rel/1.2 by this push:
     new 067c3a7a514 [To rel/1.2] Support not checking `isAligned` in select 
into (#10156)
067c3a7a514 is described below

commit 067c3a7a5147024af2a378ee17b7c7404891c263
Author: 橘子 <[email protected]>
AuthorDate: Thu Jun 15 09:18:34 2023 +0800

    [To rel/1.2] Support not checking `isAligned` in select into (#10156)
---
 .../iotdb/db/it/selectinto/IoTDBSelectIntoIT.java  | 38 +++++++++++++++++-----
 .../iotdb/db/mpp/plan/analyze/SelectIntoUtils.java |  9 +----
 2 files changed, 31 insertions(+), 16 deletions(-)

diff --git 
a/integration-test/src/test/java/org/apache/iotdb/db/it/selectinto/IoTDBSelectIntoIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/db/it/selectinto/IoTDBSelectIntoIT.java
index c9d865128f7..4c0b47d1617 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/db/it/selectinto/IoTDBSelectIntoIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/db/it/selectinto/IoTDBSelectIntoIT.java
@@ -308,6 +308,36 @@ public class IoTDBSelectIntoIT {
         "select k1, k2, k3 from root.sg_expr.d;", expectedQueryHeader, 
queryRetArray);
   }
 
+  @Test
+  public void testUsingUnMatchedAlignment() {
+    String[] intoRetArray =
+        new String[] {
+          "root.sg.d1.s1,root.sg_bk1.new_aligned_d.t1,10,",
+          "root.sg.d2.s1,root.sg_bk1.new_aligned_d.t2,7,",
+          "root.sg.d1.s2,root.sg_bk1.new_aligned_d.t3,9,",
+          "root.sg.d2.s2,root.sg_bk1.new_aligned_d.t4,8,",
+        };
+    executeNonQuery(
+        "CREATE ALIGNED TIMESERIES root.sg_bk1.new_aligned_d(t1 INT32, t2 
INT32, t3 FLOAT, t4 FLOAT);");
+    // use matched interface (aligned == aligned)
+    resultSetEqualTest(
+        "select s1, s2 into aligned root.sg_bk1.new_aligned_d(t1, t2, t3, t4) 
from root.sg.*;",
+        selectIntoHeader,
+        intoRetArray);
+    String expectedQueryHeader =
+        
"Time,root.sg_bk1.new_aligned_d.t1,root.sg_bk1.new_aligned_d.t3,root.sg_bk1.new_aligned_d.t2,root.sg_bk1.new_aligned_d.t4,";
+    resultSetEqualTest(
+        "select t1, t3, t2, t4 from root.sg_bk1.new_aligned_d;", 
expectedQueryHeader, rawDataSet);
+
+    // use unmatched interface (non-aligned != aligned)
+    resultSetEqualTest(
+        "select s1, s2 into root.sg_bk1.new_aligned_d(t1, t2, t3, t4) from 
root.sg.*;",
+        selectIntoHeader,
+        intoRetArray);
+    resultSetEqualTest(
+        "select t1, t3, t2, t4 from root.sg_bk1.new_aligned_d;", 
expectedQueryHeader, rawDataSet);
+  }
+
   // -------------------------------------- ALIGN BY DEVICE 
-------------------------------------
 
   @Test
@@ -515,14 +545,6 @@ public class IoTDBSelectIntoIT {
 
   // -------------------------------------- CHECK EXCEPTION 
-------------------------------------
 
-  @Test
-  public void testAlignmentInconsistent() {
-    executeNonQuery("CREATE ALIGNED TIMESERIES root.sg_error_bk2.new_d(t1 
INT32, t2 INT32);");
-    assertTestFail(
-        "select s1, s2 into root.sg_error_bk2.new_d(t1, t2, t3, t4) from 
root.sg.*;",
-        "The specified alignment property of the target device 
(root.sg_error_bk2.new_d) conflicts with the actual (isAligned = true).");
-  }
-
   @Test
   public void testPermission1() throws SQLException {
     try (Connection adminCon = EnvFactory.getEnv().getConnection();
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/SelectIntoUtils.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/SelectIntoUtils.java
index 6916fea6a29..58d16c446c0 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/SelectIntoUtils.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/SelectIntoUtils.java
@@ -161,14 +161,7 @@ public class SelectIntoUtils {
                   "The data type of target path (%s[%s]) is not compatible 
with the data type of source column (%s[%s]).",
                   targetPath, actualTargetPath.getSeriesType(), sourceColumn, 
sourceColumnType));
         }
-        boolean actualTargetPathAlignment = 
actualTargetPath.isUnderAlignedEntity();
-        String targetDevice = targetPath.getDevice();
-        if (targetDeviceToAlignedMap.get(targetDevice) != 
actualTargetPathAlignment) {
-          throw new SemanticException(
-              String.format(
-                  "The specified alignment property of the target device (%s) 
conflicts with the actual (isAligned = %s).",
-                  targetDevice, actualTargetPathAlignment));
-        }
+        // no need to check alignment, because the interface is universal
         targetPathWithSchema = actualTargetPath;
       }
       sourceTypeBoundTargetPathPairList.add(new Pair<>(sourceColumn, 
targetPathWithSchema));

Reply via email to