@Override
  public Optional<Statement> visitCreateAlignedTimeseries(
      final CreateAlignedTimeSeriesStatement statement, final IoTDBTreePattern pattern) {
    final int[] filteredIndexes =
        IntStream.range(0, statement.getMeasurements().size())
            .filter(
                index ->
                    pattern.matchesMeasurement(
                        statement.getDevicePath().getIDeviceIDAsFullDevice(),
                        statement.getMeasurements().get(index)))
            .toArray();
    if (filteredIndexes.length == 0) {
      return Optional.empty();
    }
    final CreateAlignedTimeSeriesStatement targetCreateAlignedTimeSeriesStatement =
        new CreateAlignedTimeSeriesStatement();
    targetCreateAlignedTimeSeriesStatement.setDevicePath(statement.getDevicePath());
    Arrays.stream(filteredIndexes)
        .forEach(
            index -> {
              targetCreateAlignedTimeSeriesStatement.addMeasurement(
                  statement.getMeasurements().get(index));
              targetCreateAlignedTimeSeriesStatement.addDataType(
                  statement.getDataTypes().get(index));
              targetCreateAlignedTimeSeriesStatement.addEncoding(
                  statement.getEncodings().get(index));
              targetCreateAlignedTimeSeriesStatement.addCompressor(
                  statement.getCompressors().get(index));
              // Non-null lists
              targetCreateAlignedTimeSeriesStatement.addTagsList(
                  statement.getTagsList().get(index));
              targetCreateAlignedTimeSeriesStatement.addAttributesList(
                  statement.getAttributesList().get(index));
              targetCreateAlignedTimeSeriesStatement.addAliasList(
                  statement.getAliasList().get(index));
            });
    return Optional.of(targetCreateAlignedTimeSeriesStatement);
  }
The {@link PipeStatementTreePatternParseVisitor} will transform the schema {@link Statement}s
using {@link IoTDBTreePattern}. Rule:

<p>1. All patterns in the output {@link Statement} will be the intersection of the original
{@link Statement}'s patterns and the given {@link IoTDBTreePattern}.

<p>2. If a pattern does not intersect with the {@link IoTDBTreePattern}, it's dropped.

<p>3. If all the patterns in the {@link Statement} is dropped, the {@link Statement} is dropped.

<p>4. The output {@link Statement} can be the altered form of the original one because it's read
from the {@link SRStatementGenerator} and will no longer be used.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/visitor/PipeStatementTreePatternParseVisitor.java