private AlignedSeriesAggregationScanOperator createLastQueryScanOperator(
      AlignedLastQueryScanNode node,
      AlignedFullPath unCachedPath,
      LocalExecutionPlanContext context) {
    // last_time, last_value
    List<TreeAggregator> aggregators = new ArrayList<>();
    boolean canUseStatistics = true;
    for (int i = 0; i < unCachedPath.getMeasurementList().size(); i++) {
      TSDataType dataType = unCachedPath.getSchemaList().get(i).getType();
      aggregators.addAll(LastQueryUtil.createAggregators(dataType, i));
      if (TSDataType.BLOB.equals(dataType)) {
        canUseStatistics = false;
      }
    }
    ITimeRangeIterator timeRangeIterator =
        initTimeRangeIterator(null, false, false, context.getZoneId());
    long maxReturnSize = calculateMaxAggregationResultSizeForLastQuery(aggregators);

    SeriesScanOptions.Builder scanOptionsBuilder = new SeriesScanOptions.Builder();
    scanOptionsBuilder.withAllSensors(new HashSet<>(unCachedPath.getMeasurementList()));
    scanOptionsBuilder.withGlobalTimeFilter(context.getGlobalTimeFilter());

    OperatorContext operatorContext =
        context
            .getDriverContext()
            .addOperatorContext(
                context.getNextOperatorId(),
                node.getPlanNodeId(),
                AlignedSeriesAggregationScanOperator.class.getSimpleName());
    AlignedSeriesAggregationScanOperator seriesAggregationScanOperator =
        new AlignedSeriesAggregationScanOperator(
            node.getPlanNodeId(),
            unCachedPath,
            Ordering.DESC,
            scanOptionsBuilder.build(),
            operatorContext,
            aggregators,
            timeRangeIterator,
            null,
            maxReturnSize,
            canUseStatistics);
    ((DataDriverContext) context.getDriverContext())
        .addSourceOperator(seriesAggregationScanOperator);
    ((DataDriverContext) context.getDriverContext()).addPath(unCachedPath);
    return seriesAggregationScanOperator;
  }
This Visitor is responsible for transferring PlanNode Tree to Operator Tree.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java