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

haonan 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 8c90117ebc5 Remove sql `merge` (#12021)
8c90117ebc5 is described below

commit 8c90117ebc551cd1bda30537245221431d9fef4e
Author: shuwenwei <[email protected]>
AuthorDate: Sun Feb 4 14:24:00 2024 +0800

    Remove sql `merge` (#12021)
---
 .../org/apache/iotdb/db/it/IoTDBDeletionIT.java    | 51 +--------------------
 ...ushQueryMergeIT.java => IoTDBFlushQueryIT.java} |  3 +-
 .../apache/iotdb/db/it/IoTDBInsertMultiRowIT.java  |  1 -
 .../org/apache/iotdb/db/it/IoTDBMultiDeviceIT.java |  1 -
 .../db/it/aligned/IoTDBAlignedDataDeletionIT.java  | 52 +---------------------
 .../iotdb/db/it/auth/IoTDBSystemPermissionIT.java  |  2 -
 .../iotdb/session/it/IoTDBSessionComplexIT.java    |  2 -
 .../org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4   | 12 +----
 .../db/queryengine/plan/parser/ASTVisitor.java     | 22 ---------
 9 files changed, 6 insertions(+), 140 deletions(-)

diff --git 
a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBDeletionIT.java 
b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBDeletionIT.java
index a16a18d2657..dd97c18a049 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBDeletionIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBDeletionIT.java
@@ -184,36 +184,6 @@ public class IoTDBDeletionIT {
     cleanData();
   }
 
-  @Test
-  public void testMerge() throws SQLException {
-    prepareMerge();
-
-    try (Connection connection = EnvFactory.getEnv().getConnection();
-        Statement statement = connection.createStatement()) {
-      statement.execute("merge");
-      statement.execute("DELETE FROM root.vehicle.d0.** WHERE time <= 15000");
-
-      // before merge completes
-      try (ResultSet set = statement.executeQuery("SELECT * FROM 
root.vehicle.d0")) {
-        int cnt = 0;
-        while (set.next()) {
-          cnt++;
-        }
-        assertEquals(5000, cnt);
-      }
-
-      // after merge completes
-      try (ResultSet set = statement.executeQuery("SELECT * FROM 
root.vehicle.d0")) {
-        int cnt = 0;
-        while (set.next()) {
-          cnt++;
-        }
-        assertEquals(5000, cnt);
-      }
-      cleanData();
-    }
-  }
-
   @Test
   public void testDelAfterFlush() throws SQLException {
     try (Connection connection = EnvFactory.getEnv().getConnection();
@@ -486,13 +456,13 @@ public class IoTDBDeletionIT {
         statement.addBatch(
             String.format(insertTemplate, i, i, i, (double) i, "'" + i + "'", 
i % 2 == 0));
       }
-      statement.addBatch("merge");
+      statement.addBatch("flush");
       // prepare Unseq-File
       for (int i = 1; i <= 100; i++) {
         statement.addBatch(
             String.format(insertTemplate, i, i, i, (double) i, "'" + i + "'", 
i % 2 == 0));
       }
-      statement.addBatch("merge");
+      statement.addBatch("flush");
       // prepare BufferWrite cache
       for (int i = 301; i <= 400; i++) {
         statement.addBatch(
@@ -513,21 +483,4 @@ public class IoTDBDeletionIT {
       statement.execute(deleteAllTemplate);
     }
   }
-
-  public void prepareMerge() throws SQLException {
-    try (Connection connection = EnvFactory.getEnv().getConnection();
-        Statement statement = connection.createStatement()) {
-
-      // prepare BufferWrite data
-      for (int i = 10001; i <= 20000; i++) {
-        statement.execute(
-            String.format(insertTemplate, i, i, i, (double) i, "'" + i + "'", 
i % 2 == 0));
-      }
-      // prepare Overflow data
-      for (int i = 1; i <= 10000; i++) {
-        statement.execute(
-            String.format(insertTemplate, i, i, i, (double) i, "'" + i + "'", 
i % 2 == 0));
-      }
-    }
-  }
 }
diff --git 
a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFlushQueryMergeIT.java
 b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFlushQueryIT.java
similarity index 98%
rename from 
integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFlushQueryMergeIT.java
rename to 
integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFlushQueryIT.java
index 18359f54240..c0b063bacbf 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFlushQueryMergeIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBFlushQueryIT.java
@@ -42,7 +42,7 @@ import static org.junit.Assert.fail;
 
 @RunWith(IoTDBTestRunner.class)
 @Category({LocalStandaloneIT.class, ClusterIT.class})
-public class IoTDBFlushQueryMergeIT {
+public class IoTDBFlushQueryIT {
 
   private static String[] sqls =
       new String[] {
@@ -96,7 +96,6 @@ public class IoTDBFlushQueryMergeIT {
           cnt++;
         }
       }
-      statement.execute("merge");
     } catch (Exception e) {
       fail(e.getMessage());
     }
diff --git 
a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertMultiRowIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertMultiRowIT.java
index d17beddec8e..7ebbcfc8472 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertMultiRowIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBInsertMultiRowIT.java
@@ -180,7 +180,6 @@ public class IoTDBInsertMultiRowIT {
       st1.execute("flush");
       st1.execute("insert into root.sg1.d1(time,s1) values(604799990,1), 
(604800001,1)");
       st1.execute("flush");
-      st1.execute("merge");
       ResultSet rs1 = st1.executeQuery("select s1 from root.sg1.d1");
       assertTrue(rs1.next());
       assertEquals(604799990, rs1.getLong("Time"));
diff --git 
a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBMultiDeviceIT.java 
b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBMultiDeviceIT.java
index 4923fbd1129..0910a14dfbb 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBMultiDeviceIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBMultiDeviceIT.java
@@ -147,7 +147,6 @@ public class IoTDBMultiDeviceIT {
       }
 
       statement.addBatch("flush");
-      statement.addBatch("merge");
 
       // unsequential data, memory data
       for (int time = 1000; time < 1100; time++) {
diff --git 
a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedDataDeletionIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedDataDeletionIT.java
index c83df7ffb01..0dfb916b378 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedDataDeletionIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedDataDeletionIT.java
@@ -180,35 +180,6 @@ public class IoTDBAlignedDataDeletionIT {
     cleanData();
   }
 
-  @Test
-  public void testMerge() throws SQLException {
-    prepareMerge();
-
-    try (Connection connection = EnvFactory.getEnv().getConnection();
-        Statement statement = connection.createStatement()) {
-      statement.execute("merge");
-      statement.execute("DELETE FROM root.vehicle.d0.** WHERE time <= 15000");
-
-      // before merge completes
-      try (ResultSet set = statement.executeQuery("SELECT * FROM 
root.vehicle.d0")) {
-        int cnt = 0;
-        while (set.next()) {
-          cnt++;
-        }
-      }
-
-      // after merge completes
-      try (ResultSet set = statement.executeQuery("SELECT * FROM 
root.vehicle.d0")) {
-        int cnt = 0;
-        while (set.next()) {
-          cnt++;
-        }
-        assertEquals(5000, cnt);
-      }
-      cleanData();
-    }
-  }
-
   @Test
   public void testDelAfterFlush() throws SQLException {
     try (Connection connection = EnvFactory.getEnv().getConnection();
@@ -505,13 +476,13 @@ public class IoTDBAlignedDataDeletionIT {
         statement.execute(
             String.format(insertTemplate, i, i, i, (double) i, "'" + i + "'", 
i % 2 == 0));
       }
-      statement.execute("merge");
+      statement.execute("flush");
       // prepare Unseq-File
       for (int i = 1; i <= 100; i++) {
         statement.execute(
             String.format(insertTemplate, i, i, i, (double) i, "'" + i + "'", 
i % 2 == 0));
       }
-      statement.execute("merge");
+      statement.execute("flush");
       // prepare BufferWrite cache
       for (int i = 301; i <= 400; i++) {
         statement.execute(
@@ -531,23 +502,4 @@ public class IoTDBAlignedDataDeletionIT {
       statement.execute(deleteAllTemplate);
     }
   }
-
-  public void prepareMerge() throws SQLException {
-    try (Connection connection = EnvFactory.getEnv().getConnection();
-        Statement statement = connection.createStatement()) {
-
-      // prepare BufferWrite data
-      for (int i = 10001; i <= 20000; i++) {
-        statement.addBatch(
-            String.format(insertTemplate, i, i, i, (double) i, "'" + i + "'", 
i % 2 == 0));
-      }
-      statement.executeBatch();
-      // prepare Overflow data
-      for (int i = 1; i <= 10000; i++) {
-        statement.addBatch(
-            String.format(insertTemplate, i, i, i, (double) i, "'" + i + "'", 
i % 2 == 0));
-      }
-      statement.executeBatch();
-    }
-  }
 }
diff --git 
a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBSystemPermissionIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBSystemPermissionIT.java
index b270862d4d5..1c4e81ddaac 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBSystemPermissionIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBSystemPermissionIT.java
@@ -236,8 +236,6 @@ public class IoTDBSystemPermissionIT {
   public void adminOperationsTest() {
     assertNonQueryTestFail(
         "flush", "803: Only the admin user can perform this operation", 
"test", "test123");
-    assertNonQueryTestFail(
-        "merge", "803: Only the admin user can perform this operation", 
"test", "test123");
     assertNonQueryTestFail(
         "clear cache", "803: Only the admin user can perform this operation", 
"test", "test123");
     assertNonQueryTestFail(
diff --git 
a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionComplexIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionComplexIT.java
index 9efe0a2b095..ca7904d8aa4 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionComplexIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionComplexIT.java
@@ -451,8 +451,6 @@ public class IoTDBSessionComplexIT {
 
       session.executeNonQueryStatement("FLUSH");
       session.executeNonQueryStatement("FLUSH root.sg1");
-      session.executeNonQueryStatement("MERGE");
-      session.executeNonQueryStatement("FULL MERGE");
 
       List<String> deviceIds = new ArrayList<>();
       queryForBatch(Collections.singletonList("root.sg1.d1"), 400);
diff --git 
a/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4 
b/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
index 851bf87307e..af9cbb8ee84 100644
--- 
a/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
+++ 
b/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
@@ -78,7 +78,7 @@ dclStatement
     ;
 
 utilityStatement
-    : merge | fullMerge | flush | clearCache | settle | repairData | explain
+    : | flush | clearCache | settle | repairData | explain
     | setSystemStatus | showVersion | showFlushInfo | showLockInfo | 
showQueryResource
     | showQueries | killQuery | grantWatermarkEmbedding | 
revokeWatermarkEmbedding
     | loadConfiguration | loadTimeseries | loadFile | removeFile | unloadFile
@@ -933,16 +933,6 @@ usernameWithRoot
  * 5. Utility Statements
  */
 
-// Merge
-merge
-    : MERGE (ON (LOCAL | CLUSTER))?
-    ;
-
-// Full Merge
-fullMerge
-    : FULL MERGE (ON (LOCAL | CLUSTER))?
-    ;
-
 // Flush
 flush
     : FLUSH prefixPath? (COMMA prefixPath)* boolean_literal? (ON (LOCAL | 
CLUSTER))?
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java
index 93ac57753d2..fedc436cb32 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java
@@ -188,7 +188,6 @@ import 
org.apache.iotdb.db.queryengine.plan.statement.sys.ExplainStatement;
 import org.apache.iotdb.db.queryengine.plan.statement.sys.FlushStatement;
 import org.apache.iotdb.db.queryengine.plan.statement.sys.KillQueryStatement;
 import 
org.apache.iotdb.db.queryengine.plan.statement.sys.LoadConfigurationStatement;
-import org.apache.iotdb.db.queryengine.plan.statement.sys.MergeStatement;
 import org.apache.iotdb.db.queryengine.plan.statement.sys.RepairDataStatement;
 import 
org.apache.iotdb.db.queryengine.plan.statement.sys.SetSystemStatusStatement;
 import org.apache.iotdb.db.queryengine.plan.statement.sys.ShowQueriesStatement;
@@ -3122,27 +3121,6 @@ public class ASTVisitor extends 
IoTDBSqlParserBaseVisitor<Statement> {
     return parseIdentifier(ctx.getText());
   }
 
-  // Merge
-  @Override
-  public Statement visitMerge(IoTDBSqlParser.MergeContext ctx) {
-    MergeStatement mergeStatement = new MergeStatement(StatementType.MERGE);
-    if (ctx.CLUSTER() != null && 
!IoTDBDescriptor.getInstance().getConfig().isClusterMode()) {
-      throw new SemanticException("MERGE ON CLUSTER is not supported in 
standalone mode");
-    }
-    mergeStatement.setOnCluster(ctx.LOCAL() == null);
-    return mergeStatement;
-  }
-
-  @Override
-  public Statement visitFullMerge(IoTDBSqlParser.FullMergeContext ctx) {
-    MergeStatement mergeStatement = new 
MergeStatement(StatementType.FULL_MERGE);
-    if (ctx.CLUSTER() != null && 
!IoTDBDescriptor.getInstance().getConfig().isClusterMode()) {
-      throw new SemanticException("FULL MERGE ON CLUSTER is not supported in 
standalone mode");
-    }
-    mergeStatement.setOnCluster(ctx.LOCAL() == null);
-    return mergeStatement;
-  }
-
   // Flush
 
   @Override

Reply via email to