@Override
  public Result apply(TableFunctionProcessorNode node, Captures captures, Context context) {
    if (node.getChildren().isEmpty() || !node.getPassThroughSpecification().isPresent()) {
      return Result.empty();
    }

    ImmutableSet.Builder<Symbol> requiredInputs = ImmutableSet.builder();
    for (TableFunctionNode.PassThroughColumn column :
        node.getPassThroughSpecification().get().getColumns()) {
      requiredInputs.add(column.getSymbol());
    }
    node.getRequiredSymbols().forEach(requiredInputs::add);

    node.getDataOrganizationSpecification()
        .ifPresent(
            specification -> {
              requiredInputs.addAll(specification.getPartitionBy());
              specification
                  .getOrderingScheme()
                  .ifPresent(orderingScheme -> requiredInputs.addAll(orderingScheme.getOrderBy()));
            });

    return restrictOutputs(context.getIdAllocator(), node.getChild(), requiredInputs.build())
        .map(
            child ->
                Result.ofPlanNode(
                    new TableFunctionProcessorNode(
                        node.getPlanNodeId(),
                        node.getName(),
                        node.getProperOutputs(),
                        Optional.of(child),
                        node.getPassThroughSpecification(),
                        node.getRequiredSymbols(),
                        node.getDataOrganizationSpecification(),
                        node.isRowSemantic(),
                        node.getTableFunctionHandle(),
                        node.isRequireRecordSnapshot())))
        .orElse(Result.empty());
  }
This rule prunes unreferenced outputs of TableFunctionProcessorNode. Any source output symbols
not included in the required symbols can be pruned.

<p>First, it extracts all symbols required for:

<ul>
  <li>- pass-through
  <li>- table function computation
  <li>- partitioning and ordering (including the hashSymbol)
</ul>

<p>Next, a mapping of input symbols to marker symbols is updated so that it only contains
mappings for the required symbols.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/iterative/rule/PruneTableFunctionProcessorSourceColumns.java