presto-main/src/main/java/io/prestosql/sql/planner/optimizations/UnaliasSymbolReferences.java/UnaliasSymbolReferences/visitWindow
class UnaliasSymbolReferences:        @Override
        public PlanNode visitWindow(WindowNode node, RewriteContext<Void> context)
        {
            PlanNode source = context.rewrite(node.getSource());

            ImmutableMap.Builder<Symbol, WindowNode.Function> functions = ImmutableMap.builder();
            node.getWindowFunctions().forEach((symbol, function) -> {
                ResolvedFunction resolvedFunction = function.getResolvedFunction();
                List<Expression> arguments = canonicalize(function.getArguments());
                WindowNode.Frame canonicalFrame = canonicalize(function.getFrame());

                functions.put(canonicalize(symbol), new WindowNode.Function(resolvedFunction, arguments, canonicalFrame, function.isIgnoreNulls()));
            });

            return new WindowNode(
                    node.getId(),
                    source,
                    canonicalizeAndDistinct(node.getSpecification()),
                    functions.build(),
                    canonicalize(node.getHashSymbol()),
                    canonicalize(node.getPrePartitionedInputs()),
                    node.getPreSortedOrderPrefix());
        }