private Void randomDeletion(
      AtomicLong writtenPointCounter,
      AtomicLong deletedPointCounter,
      ExecutorService allThreads,
      int fileNumMax,
      int pointPerFile,
      int deletionRange,
      int minIntervalToRecord,
      int testNum)
      throws SQLException, InterruptedException {
    // delete random 100 points each time
    List<TimeRange> undeletedRanges = new ArrayList<>();
    // pointPerFile * fileNumMax
    long deletionEnd = (long) fileNumMax * pointPerFile - 1;
    long nextRangeStart = 0;
    Random random = new Random();

    try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT);
        Statement statement = connection.createStatement()) {

      statement.execute("create database if not exists test");
      statement.execute("use test");
      while ((writtenPointCounter.get() < deletionEnd || !undeletedRanges.isEmpty())
          && !Thread.interrupted()) {
        // record the newly inserted interval if it is long enough
        long currentWrittenTime = writtenPointCounter.get();
        if (currentWrittenTime - nextRangeStart >= minIntervalToRecord) {
          undeletedRanges.add(new TimeRange(nextRangeStart, currentWrittenTime));
          nextRangeStart = currentWrittenTime + 1;
        }
        if (undeletedRanges.isEmpty()) {
          Thread.sleep(10);
          continue;
        }
        // pick up a random range
        int rangeIndex = random.nextInt(undeletedRanges.size());
        TimeRange timeRange = undeletedRanges.get(rangeIndex);
        // delete a random part in the range
        LOGGER.info("Pick up a range [{}, {}]", timeRange.getMin(), timeRange.getMax());
        long rangeDeletionStart;
        long timeRangeLength = timeRange.getMax() - timeRange.getMin() + 1;
        if (timeRangeLength == 1) {
          rangeDeletionStart = timeRange.getMin();
        } else {
          rangeDeletionStart = random.nextInt((int) (timeRangeLength - 1)) + timeRange.getMin();
        }
        long rangeDeletionEnd = Math.min(rangeDeletionStart + deletionRange, timeRange.getMax());
        LOGGER.info("Deletion range [{}, {}]", rangeDeletionStart, rangeDeletionEnd);

        statement.execute(
            "delete from test.table"
                + testNum
                + " where time >= "
                + rangeDeletionStart
                + " and time <= "
                + rangeDeletionEnd);
        deletedPointCounter.addAndGet(rangeDeletionEnd - rangeDeletionStart + 1);
        LOGGER.info(
            "Deleted range [{}, {}], written points: {}, deleted points: {}",
            timeRange.getMin(),
            timeRange.getMax(),
            currentWrittenTime + 1,
            deletedPointCounter.get());

        // update the range
        if (rangeDeletionStart == timeRange.getMin() && rangeDeletionEnd == timeRange.getMax()) {
          // range fully deleted
          undeletedRanges.remove(rangeIndex);
        } else if (rangeDeletionStart == timeRange.getMin()) {
          // prefix deleted
          timeRange.setMin(rangeDeletionEnd + 1);
        } else if (rangeDeletionEnd == timeRange.getMax()) {
          // suffix deleted
          timeRange.setMax(rangeDeletionStart - 1);
        } else {
          // split into two ranges
          undeletedRanges.add(new TimeRange(rangeDeletionEnd + 1, timeRange.getMax()));
          timeRange.setMax(rangeDeletionStart - 1);
        }

        // check the point count
        try (ResultSet set =
            statement.executeQuery(
                "select count(*) from table" + testNum + " where time <= " + currentWrittenTime)) {
          assertTrue(set.next());
          long expectedCnt = currentWrittenTime + 1 - deletedPointCounter.get();
          if (expectedCnt != set.getLong(1)) {
            undeletedRanges = mergeRanges(undeletedRanges);
            List<TimeRange> remainingRanges =
                collectDataRanges(statement, currentWrittenTime, testNum);
            LOGGER.info("Expected ranges: {}", undeletedRanges);
            LOGGER.info("Remaining ranges: {}", remainingRanges);
            fail(
                String.format(
                    "Inconsistent number of points %d - %d", expectedCnt, set.getLong(1)));
          }
        }

        Thread.sleep(10);
      }
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      return null;
    } catch (SQLException e) {
      if (e.getMessage().contains("Fail to reconnect")) {
        // restart triggered, ignore
        return null;
      } else {
        allThreads.shutdownNow();
        throw e;
      }
    } catch (ParallelRequestTimeoutException ignored) {
      // restart triggered, ignore
      return null;
    } catch (Throwable e) {
      allThreads.shutdownNow();
      throw e;
    }
    return null;
  }
Should delete this case after the deletion value filter feature be implemented
integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBDeletionTableIT.java