public TemplatedLogicalPlanBuilder planFilter(
      Expression filterExpression, boolean isGroupByTime, Ordering scanOrder) {

    if (filterExpression == null) {
      return this;
    }

    FilterNode filterNode =
        new FilterNode(
            context.getQueryId().genPlanNodeId(),
            this.getRoot(),
            null,
            filterExpression,
            isGroupByTime,
            scanOrder,
            true);
    analysis.setFromWhere(filterNode);

    this.root = filterNode;

    return this;
  }
This class provides accelerated implementation for multiple devices align by device query. This
optimization is only used for devices set in only one template, using template can avoid many
unnecessary judgements.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/TemplatedLogicalPlanBuilder.java