@Test
  public void do_test()
      throws InterruptedException,
          TException,
          IoTDBConnectionException,
          IOException,
          StatementExecutionException {
    // Write data before subscribing
    insert_data(1704038396000L); // 2023-12-31 23:59:56+08:00
    consumer =
        new SubscriptionTreePushConsumer.Builder()
            .host(SRC_HOST)
            .port(SRC_PORT)
            .consumerId("DB_time_range_dataset")
            .consumerGroupId("push_time")
            .ackStrategy(AckStrategy.AFTER_CONSUME)
            .consumeListener(
                message -> {
                  for (final SubscriptionSessionDataSet dataSet :
                      message.getSessionDataSetsHandler()) {
                    try {
                      Tablet tablet = dataSet.getTablet();
                      session_dest.insertTablet(tablet);
                    } catch (StatementExecutionException e) {
                      throw new RuntimeException(e);
                    } catch (IoTDBConnectionException e) {
                      throw new RuntimeException(e);
                    }
                  }
                  return ConsumeResult.SUCCESS;
                })
            .buildPushConsumer();
    consumer.open();
    // Subscribe
    consumer.subscribe(topicName);
    subs.getSubscriptions().forEach(System.out::println);
    assertEquals(subs.getSubscriptions().size(), 1, "show subscriptions after subscription");

    AWAIT.untilAsserted(
        () -> {
          check_count(2, "select count(s_0) from " + device, "Start time boundary data:" + pattern);
        });

    insert_data(System.currentTimeMillis()); // now
    AWAIT.untilAsserted(
        () -> {
          check_count(
              2, "select count(s_0) from " + device, "Write some real-time data after:" + pattern);
        });

    insert_data(1707782400000L); // 2024-02-13 08:00:00+08:00
    AWAIT.untilAsserted(
        () -> {
          check_count(
              6, "select count(s_0) from " + device, "Data within the time range:" + pattern);
        });

    insert_data(1711814398000L); // 2024-03-30 23:59:58+08:00
    AWAIT.untilAsserted(
        () -> {
          // Because the end time is 2024-03-31 00:00:00, closed interval
          check_count(8, "select count(s_0) from " + device, "End time limit data:" + pattern);
        });

    insert_data(1711900798000L); // 2024-03-31 23:59:58+08:00
    AWAIT.untilAsserted(
        () -> {
          check_count(8, "select count(s_0) from " + device, "End time limit data:" + pattern);
        });
  }
Start time, end time are both closed intervals. If not specified, the time will be 00:00:00.
integration-test/src/test/java/org/apache/iotdb/subscription/it/triple/treemodel/regression/pushconsumer/time/IoTDBTimeRangeDBDataSetPushConsumerIT.java