示例#1
0
        private BoundRelation PushOverTop(BoundFilterRelation node, BoundTopRelation input)
        {
            var newFilter = RewriteRelation(node.Update(input.Input, node.Condition));
            var newInput  = input.Update(newFilter, input.Limit, input.TieEntries);

            return(newInput);
        }
        private static CardinalityEstimate EstimateTopRelation(BoundTopRelation relation)
        {
            var input = Estimate(relation.Input);

            return(relation.TieEntries.Any()
                ? input
                : new CardinalityEstimate(input.Minimum, relation.Limit));
        }
示例#3
0
        private Iterator BuildTopWithTies(BoundTopRelation relation)
        {
            var input = BuildRelation(relation.Input);
            var rowBufferAllocation = BuildRowBufferAllocation(relation.Input, input.RowBuffer);
            var tieEntries          = relation.TieEntries.Select(t => rowBufferAllocation[t.ValueSlot]).ToImmutableArray();
            var tieComparers        = relation.TieEntries.Select(t => t.Comparer).ToImmutableArray();

            return(new TopWithTiesIterator(input, relation.Limit, tieEntries, tieComparers));
        }
示例#4
0
        protected override BoundRelation RewriteTopRelation(BoundTopRelation node)
        {
            _recorder.Record(node.TieEntries);

            return(base.RewriteTopRelation(node));
        }
示例#5
0
 private static ShowPlanNode BuildTop(BoundTopRelation node)
 {
     var tieEntries   = string.Join(@", ", node.TieEntries.Select(v => v.ValueSlot.Name));
     var operatorName = $"Top {node.Limit}{(!node.TieEntries.Any() ? string.Empty : $" With Ties ({tieEntries})")}";
示例#6
0
        private Iterator BuildTopWithoutTies(BoundTopRelation relation)
        {
            var input = BuildRelation(relation.Input);

            return(new TopIterator(input, relation.Limit));
        }
示例#7
0
 private Iterator BuildTop(BoundTopRelation relation)
 {
     return(relation.TieEntries.Any()
                ? BuildTopWithTies(relation)
                : BuildTopWithoutTies(relation));
 }