Beispiel #1
0
        private BoundRelation PushOverCompute(BoundFilterRelation node, BoundComputeRelation input)
        {
            BoundExpression remainder = null;
            BoundExpression pushed    = null;

            foreach (var conjunction in Expression.SplitConjunctions(node.Condition))
            {
                if (conjunction.DependsOnAny(input.GetDefinedValues()))
                {
                    remainder = Expression.And(remainder, conjunction);
                }
                else
                {
                    pushed = Expression.And(pushed, conjunction);
                }
            }

            var newInputInput = pushed == null
                ? input.Input
                : new BoundFilterRelation(input.Input, pushed);

            var newInput = RewriteRelation(input.Update(newInputInput, input.DefinedValues));

            var newNode = remainder == null
                ? newInput
                : new BoundFilterRelation(newInput, remainder);

            return(newNode);
        }
        protected override BoundRelation RewriteComputeRelation(BoundComputeRelation node)
        {
            var input           = RewriteRelation(node.Input);
            var computedValues  = RewriteComputedValues(node.DefinedValues);
            var inputWithProbes = RewriteInputWithSubqueries(input);

            return(node.Update(inputWithProbes, computedValues));
        }
Beispiel #3
0
        protected override BoundRelation RewriteComputeRelation(BoundComputeRelation node)
        {
            var newInput = RewriteRelation(node.Input);

            if (newInput is BoundFilterRelation filter)
            {
                node = node.Update(filter.Input, node.DefinedValues);
                return(filter.WithInput(node));
            }
            else
            {
                return(node.WithInput(newInput));
            }
        }
Beispiel #4
0
        protected override BoundRelation RewriteComputeRelation(BoundComputeRelation node)
        {
            var definedValues = RemoveUnusedSlots(node.DefinedValues, d => d.ValueSlot);

            node = node.Update(node.Input, definedValues);

            _recorder.Record(definedValues);

            if (!definedValues.Any())
            {
                return(RewriteRelation(node.Input));
            }

            return(base.RewriteComputeRelation(node));
        }