public static bool ContainsSubquery(BoundExpression node)
        {
            var checker = new SubqueryChecker();

            checker.VisitExpression(node);
            return(checker.SubqueryFound);
        }
        private static bool NeedsRewriting(BoundJoinRelation node)
        {
            if (node.JoinType != BoundJoinType.FullOuter)
            {
                return(false);
            }

            if (SubqueryChecker.ContainsSubquery(node.Condition))
            {
                return(true);
            }

            var left  = node.Left.GetOutputValues().ToImmutableArray();
            var right = node.Right.GetOutputValues().ToImmutableArray();

            var conjunctions = Expression.SplitConjunctions(node.Condition);

            return(!conjunctions.Any(c => CanBeUsedForHashMatch(left, right, c)));
        }