@Override
    public PlanAndMappings visitTopK(TopKNode node, UnaliasContext context) {
      List<PlanAndMappings> rewrittenSources =
          node.getChildren().stream()
              .map(child -> child.accept(this, context))
              .collect(Collectors.toList());
      Map<Symbol, Symbol> mapping = new HashMap<>();
      rewrittenSources.forEach(map -> map.getMappings().forEach(mapping::putIfAbsent));
      SymbolMapper mapper = symbolMapper(mapping);

      TopKNode rewrittenTopN =
          mapper.map(
              node,
              rewrittenSources.stream().map(PlanAndMappings::getRoot).collect(Collectors.toList()));

      return new PlanAndMappings(rewrittenTopN, mapping);
    }
Replace all symbols in the plan with new symbols. The returned plan has different output than
the original plan. Also, the order of symbols might change during symbol replacement. Symbols
in the list `fields` are replaced maintaining the order so they might be used to match original
symbols with their replacements. Replacing symbols helps avoid collisions when symbols or parts
of the plan are reused.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/UnaliasSymbolReferences.java