public static Optional<Set<Symbol>> pruneInputs(
      Collection<Symbol> availableInputs, Collection<Expression> expressions) {
    Set<Symbol> availableInputsSet = ImmutableSet.copyOf(availableInputs);
    Set<Symbol> prunedInputs =
        Sets.filter(availableInputsSet, SymbolsExtractor.extractUnique(expressions)::contains);

    if (prunedInputs.size() == availableInputsSet.size()) {
      return Optional.empty();
    }

    return Optional.of(prunedInputs);
  }
Prune the set of available inputs to those required by the given expressions.

<p>If all inputs are used, return Optional.empty() to indicate that no pruning is necessary.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/iterative/rule/Util.java