private static void prepareFile(
      String sgName,
      TsFileResource tsFileResource,
      long timeOffset,
      long ptNum,
      long valueOffset,
      List<IMeasurementSchema> measurementSchemas)
      throws IOException, WriteProcessException {
    File file = tsFileResource.getTsFile();
    if (!file.getParentFile().exists()) {
      Assert.assertTrue(file.getParentFile().mkdirs());
    }
    TsFileWriter fileWriter = new TsFileWriter(file);

    String device0 = sgName + PATH_SEPARATOR + "device0";
    String device1 = sgName + PATH_SEPARATOR + "device1";
    String device2 = sgName + PATH_SEPARATOR + "device2";

    fileWriter.registerAlignedTimeseries(new Path(device0), measurementSchemas);
    fileWriter.registerAlignedTimeseries(new Path(device1), measurementSchemas);
    fileWriter.registerTimeseries(new Path(device2), measurementSchemas);
    for (long i = timeOffset; i < timeOffset + ptNum; i++) {

      TSRecord record = new TSRecord(device0, i);
      int index = 0;
      for (IMeasurementSchema measurementSchema : measurementSchemas) {
        record.addTuple(
            DataPoint.getDataPoint(
                measurementSchema.getType(),
                measurementSchema.getMeasurementName(),
                index == 0
                    ? String.valueOf((i + valueOffset) % 2 == 0)
                    : String.valueOf((i + valueOffset))));
        index++;
      }
      fileWriter.writeRecord(record);
      tsFileResource.updateStartTime(IDeviceID.Factory.DEFAULT_FACTORY.create(device0), i);
      tsFileResource.updateEndTime(IDeviceID.Factory.DEFAULT_FACTORY.create(device0), i);

      record.deviceId = IDeviceID.Factory.DEFAULT_FACTORY.create(device1);
      fileWriter.writeRecord(record);
      tsFileResource.updateStartTime(IDeviceID.Factory.DEFAULT_FACTORY.create(device1), i);
      tsFileResource.updateEndTime(IDeviceID.Factory.DEFAULT_FACTORY.create(device1), i);

      record.deviceId = IDeviceID.Factory.DEFAULT_FACTORY.create(device2);
      fileWriter.writeRecord(record);
      tsFileResource.updateStartTime(IDeviceID.Factory.DEFAULT_FACTORY.create(device2), i);
      tsFileResource.updateEndTime(IDeviceID.Factory.DEFAULT_FACTORY.create(device2), i);

      long flushInterval = 20;
      if ((i + 1) % flushInterval == 0) {
        fileWriter.flush();
      }
    }
    fileWriter.close();
  }
This util contains 5 seqFiles and 5 unseqFiles in default.

<p>Sequence time range of data: [0, 99], [100, 199], [200, 299], [300, 399], [400, 499]

<p>UnSequence time range of data: [0, 19], [100, 139], [200, 259], [300, 379], [400, 499], [0,
199]

<p>d0 and d1 are aligned, d2 is nonAligned
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/operator/AlignedSeriesTestUtil.java