presto-main/src/main/java/io/prestosql/sql/analyzer/Scope.java/Scope/getNamedQuery
class Scope:    public Optional<WithQuery> getNamedQuery(String name)
    {
        if (namedQueries.containsKey(name)) {
            return Optional.of(namedQueries.get(name));
        }

        if (parent.isPresent()) {
            return parent.get().getNamedQuery(name);
        }

        return Optional.empty();
    }