@Test
  public void overFlowTest() {
    String sql = "SELECT value from root.overflow ALIGN BY DEVICE";
    try (Connection connection = EnvFactory.getEnv().getConnection();
        Statement statement = connection.createStatement()) {

      try (ResultSet resultSet = statement.executeQuery(sql)) {
        long startTime = 1;
        ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
        checkHeader(resultSetMetaData, "Time,Device,value");
        int cnt = 0;
        while (resultSet.next()) {
          long actualTimeStamp = resultSet.getLong(1);
          String actualDevice = resultSet.getString(2);
          assertEquals("root.overflow", actualDevice);
          assertEquals(startTime + 2147483648L, actualTimeStamp);

          String value = resultSet.getString(3);
          assertEquals(value, Integer.toString(cnt));
          startTime += 2147483648L;
          cnt++;
        }
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
This method generate test data with crossing time.

<p>The data can be viewed in online doc:

<p>https://docs.google.com/spreadsheets/d/18XlOIi27ZIIdRnar2WNXVMxkZwjgwlPZmzJLVpZRpAA/edit#gid=0
integration-test/src/test/java/org/apache/iotdb/db/it/alignbydevice/IoTDBOrderByWithAlignByDeviceIT.java