Ejemplo n.º 1
0
        public override AlgebraNode VisitResultAlgebraNode(ResultAlgebraNode node)
        {
            ShowPlanElement inputElement = ConvertNode(node.Input);

            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();

            propertyListBuilder.Begin(Resources.ShowPlanGroupOutputList);
            for (int i = 0; i < node.OutputList.Length; i++)
            {
                propertyListBuilder.Begin();
                propertyListBuilder.SetGroupValue(String.Format(CultureInfo.InvariantCulture, "{0} AS {1}", node.OutputList[i].Name, node.ColumnNames[i]));
                WriteRowBufferEntry(propertyListBuilder, node.OutputList[i]);
                propertyListBuilder.Write(Resources.ShowPlanKeyOutputName, node.ColumnNames[i]);
                propertyListBuilder.End();
            }
            propertyListBuilder.End();

            IList <ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.Select, properties, inputElement);

            _currentElement = element;

            return(node);
        }
Ejemplo n.º 2
0
        public override AlgebraNode VisitHashMatchAlgebraNode(HashMatchAlgebraNode node)
        {
            ShowPlanElement buildElement = ConvertNode(node.Left);
            ShowPlanElement probeElement = ConvertNode(node.Right);

            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();

            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);

            WriteRowBufferEntry(propertyListBuilder, Resources.ShowPlanKeyHashKeysBuild, node.BuildKeyEntry);
            WriteRowBufferEntry(propertyListBuilder, Resources.ShowPlanKeyHashKeysProbe, node.ProbeEntry);
            propertyListBuilder.Write(Resources.ShowPlanKeyLogicalOperator, LogicalOperatorToString(node.Op));

            if (node.ProbeResidual != null)
            {
                propertyListBuilder.Write(Resources.ShowPlanKeyProbeResidual, node.ProbeResidual.GenerateSource());
            }

            IList <ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.HashMatch, properties, buildElement, probeElement);

            _currentElement = element;

            return(node);
        }
Ejemplo n.º 3
0
        public override AlgebraNode VisitTopAlgebraNode(TopAlgebraNode node)
        {
            ShowPlanElement inputElement = ConvertNode(node.Input);

            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();

            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);

            propertyListBuilder.Write(Resources.ShowPlanKeyLimit, node.Limit.ToString(CultureInfo.InvariantCulture));

            if (node.TieEntries == null)
            {
                propertyListBuilder.Write(Resources.ShowPlanKeyWithTies, Boolean.FalseString);
            }
            else
            {
                propertyListBuilder.Write(Resources.ShowPlanKeyWithTies, Boolean.TrueString);
                AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupTieColumns, node.TieEntries);
            }

            IList <ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.Top, properties, inputElement);

            _currentElement = element;

            return(node);
        }
Ejemplo n.º 4
0
        public override AlgebraNode VisitJoinAlgebraNode(JoinAlgebraNode node)
        {
            ShowPlanElement leftElement  = ConvertNode(node.Left);
            ShowPlanElement rightElement = ConvertNode(node.Right);

            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();

            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            propertyListBuilder.Write(Resources.ShowPlanKeyLogicalOperator, LogicalOperatorToString(node.Op));
            AddStatistics(propertyListBuilder, node.StatisticsIterator);

            if (node.Predicate != null)
            {
                propertyListBuilder.Write(Resources.ShowPlanKeyPredicate, node.Predicate.GenerateSource());
            }

            if (node.OuterReferences != null && node.OuterReferences.Length > 0)
            {
                AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOuterReferences, node.OuterReferences);
            }

            if (node.ProbeBufferEntry != null)
            {
                WriteRowBufferEntry(propertyListBuilder, Resources.ShowPlanKeyProbeColumn, node.ProbeBufferEntry);
            }

            if (node.PassthruPredicate != null)
            {
                propertyListBuilder.Write(Resources.ShowPlanKeyPassthru, node.PassthruPredicate.GenerateSource());
            }

            // We give a warning if a join has no predicate and no outer reference.
            // In this case the join would simply multiply the other side.
            // However, we supppress the warning if any side is known at produce at
            // most one row.
            if (node.Predicate == null &&
                (node.OuterReferences == null || node.OuterReferences.Length == 0) &&
                !AstUtil.WillProduceAtMostOneRow(node.Left) &&
                !AstUtil.WillProduceAtMostOneRow(node.Right))
            {
                propertyListBuilder.Write(Resources.ShowPlanKeyWarning, Resources.ShowPlanWarningNoJoinPredicate);
            }

            IList <ShowPlanProperty> properties = propertyListBuilder.ToList();
            ShowPlanElement          element    = new ShowPlanElement(ShowPlanOperator.NestedLoops, properties, leftElement, rightElement);

            _currentElement = element;

            return(node);
        }
Ejemplo n.º 5
0
        public override AlgebraNode VisitComputeScalarAlgebraNode(ComputeScalarAlgebraNode node)
        {
            ShowPlanElement inputElement = ConvertNode(node.Input);

            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();
            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);
            AddDefinedValues(propertyListBuilder, node.DefinedValues);

            IList<ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.ComputeScalar, properties, inputElement);
            _currentElement = element;

            return node;
        }
Ejemplo n.º 6
0
        public override AlgebraNode VisitNullScanAlgebraNode(NullScanAlgebraNode node)
        {
            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();

            propertyListBuilder.Write(Resources.ShowPlanKeyEmpty, Boolean.TrueString);
            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);

            IList <ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.ConstantScan, properties);

            _currentElement = element;

            return(node);
        }
Ejemplo n.º 7
0
        public override AlgebraNode VisitTableAlgebraNode(TableAlgebraNode node)
        {
            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();

            propertyListBuilder.Write(Resources.ShowPlanKeyTable, String.Format(CultureInfo.InvariantCulture, "{0} AS {1}", node.TableRefBinding.TableBinding.Name, node.TableRefBinding.Name));
            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);

            IList <ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.TableScan, properties);

            _currentElement = element;

            return(node);
        }
Ejemplo n.º 8
0
        public override AlgebraNode VisitAssertAlgebraNode(AssertAlgebraNode node)
        {
            ShowPlanElement inputElement = ConvertNode(node.Input);

            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();
            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);

            propertyListBuilder.Write(Resources.ShowPlanKeyPredicate, node.Predicate.GenerateSource());

            IList<ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.Assert, properties, inputElement);
            _currentElement = element;

            return node;
        }
Ejemplo n.º 9
0
        public override AstNode VisitTableSpoolRefAlgebraNode(StackedTableSpoolRefAlgebraNode node)
        {
            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();

            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);
            propertyListBuilder.Write(Resources.ShowPlanKeyLogicalOperator, Resources.ShowPlanLogicalOperatorLazySpool);
            propertyListBuilder.Write(Resources.ShowPlanKeyWithStack, Boolean.TrueString);

            IList <ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.TableSpool, properties);

            _currentElement = element;

            return(node);
        }
Ejemplo n.º 10
0
        public override AlgebraNode VisitComputeScalarAlgebraNode(ComputeScalarAlgebraNode node)
        {
            ShowPlanElement inputElement = ConvertNode(node.Input);

            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();

            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);
            AddDefinedValues(propertyListBuilder, node.DefinedValues);

            IList <ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.ComputeScalar, properties, inputElement);

            _currentElement = element;

            return(node);
        }
Ejemplo n.º 11
0
        public override AlgebraNode VisitAggregateAlgebraNode(AggregateAlgebraNode node)
        {
            ShowPlanElement inputElement = ConvertNode(node.Input);

            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();
            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);
            AddDefinedValues(propertyListBuilder, node.DefinedValues);

            if (node.Groups != null && node.Groups.Length > 0)
                AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupGroupBy, node.Groups);

            IList<ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.StreamAggregate, properties, inputElement);
            _currentElement = element;

            return node;
        }
Ejemplo n.º 12
0
        public override AlgebraNode VisitAssertAlgebraNode(AssertAlgebraNode node)
        {
            ShowPlanElement inputElement = ConvertNode(node.Input);

            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();

            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);

            propertyListBuilder.Write(Resources.ShowPlanKeyPredicate, node.Predicate.GenerateSource());

            IList <ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.Assert, properties, inputElement);

            _currentElement = element;

            return(node);
        }
Ejemplo n.º 13
0
        public override AlgebraNode VisitIndexSpoolAlgebraNode(IndexSpoolAlgebraNode node)
        {
            ShowPlanElement inputElement = ConvertNode(node.Input);

            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();

            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);
            propertyListBuilder.Write(Resources.ShowPlanKeyLogicalOperator, Resources.ShowPlanLogicalOperatorEagerSpool);
            propertyListBuilder.Write(Resources.ShowPlanKeyWithStack, Boolean.FalseString);

            WriteRowBufferEntry(propertyListBuilder, Resources.ShowPlanKeyIndex, node.IndexEntry);
            propertyListBuilder.Write(Resources.ShowPlanKeyProbe, node.ProbeExpression.GenerateSource());

            IList <ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.IndexSpool, properties, inputElement);

            _currentElement = element;

            return(node);
        }
Ejemplo n.º 14
0
        public override AlgebraNode VisitSortAlgebraNode(SortAlgebraNode node)
        {
            ShowPlanElement inputElement = ConvertNode(node.Input);

            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();

            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);

            if (node.Distinct)
            {
                propertyListBuilder.Write(Resources.ShowPlanKeyLogicalOperator, Resources.ShowPlanLogicalOperatorDistinctSort);
            }
            else
            {
                propertyListBuilder.Write(Resources.ShowPlanKeyLogicalOperator, Resources.ShowPlanLogicalOperatorSort);
            }

            propertyListBuilder.Begin(Resources.ShowPlanGroupOrderBy);
            for (int i = 0; i < node.SortEntries.Length; i++)
            {
                string sortOrder = SortOrderToString(node.SortOrders[i]);

                propertyListBuilder.Begin();
                propertyListBuilder.SetGroupValue(String.Format(CultureInfo.InvariantCulture, "{0} {1}", node.SortEntries[i].Name, sortOrder));
                WriteRowBufferEntry(propertyListBuilder, node.SortEntries[i]);
                propertyListBuilder.Write(Resources.ShowPlanKeyOrder, sortOrder);
                propertyListBuilder.End();
            }
            propertyListBuilder.End();

            IList <ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.Sort, properties, inputElement);

            _currentElement = element;

            return(node);
        }
Ejemplo n.º 15
0
        public override AlgebraNode VisitAggregateAlgebraNode(AggregateAlgebraNode node)
        {
            ShowPlanElement inputElement = ConvertNode(node.Input);

            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();

            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);
            AddDefinedValues(propertyListBuilder, node.DefinedValues);

            if (node.Groups != null && node.Groups.Length > 0)
            {
                AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupGroupBy, node.Groups);
            }

            IList <ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.StreamAggregate, properties, inputElement);

            _currentElement = element;

            return(node);
        }
Ejemplo n.º 16
0
        public override AlgebraNode VisitConcatAlgebraNode(ConcatAlgebraNode node)
        {
            List <ShowPlanElement> inputList = new List <ShowPlanElement>();

            foreach (AlgebraNode inputNode in node.Inputs)
            {
                inputList.Add(ConvertNode(inputNode));
            }

            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();

            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);
            AddDefinedValues(propertyListBuilder, node.DefinedValues);

            IList <ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.Concatenation, properties, inputList.ToArray());

            _currentElement = element;

            return(node);
        }
Ejemplo n.º 17
0
        public override AlgebraNode VisitIndexSpoolAlgebraNode(IndexSpoolAlgebraNode node)
        {
            ShowPlanElement inputElement = ConvertNode(node.Input);

            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();
            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);
            propertyListBuilder.Write(Resources.ShowPlanKeyLogicalOperator, Resources.ShowPlanLogicalOperatorEagerSpool);
            propertyListBuilder.Write(Resources.ShowPlanKeyWithStack, Boolean.FalseString);

            WriteRowBufferEntry(propertyListBuilder, Resources.ShowPlanKeyIndex, node.IndexEntry);
            propertyListBuilder.Write(Resources.ShowPlanKeyProbe, node.ProbeExpression.GenerateSource());

            IList<ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.IndexSpool, properties, inputElement);
            _currentElement = element;

            return node;
        }
Ejemplo n.º 18
0
        public override AlgebraNode VisitResultAlgebraNode(ResultAlgebraNode node)
        {
            ShowPlanElement inputElement = ConvertNode(node.Input);

            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();
            propertyListBuilder.Begin(Resources.ShowPlanGroupOutputList);
            for (int i = 0; i < node.OutputList.Length; i++)
            {
                propertyListBuilder.Begin();
                propertyListBuilder.SetGroupValue(String.Format(CultureInfo.InvariantCulture, "{0} AS {1}", node.OutputList[i].Name, node.ColumnNames[i]));
                WriteRowBufferEntry(propertyListBuilder, node.OutputList[i]);
                propertyListBuilder.Write(Resources.ShowPlanKeyOutputName, node.ColumnNames[i]);
                propertyListBuilder.End();
            }
            propertyListBuilder.End();

            IList<ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.Select, properties, inputElement);
            _currentElement = element;

            return node;
        }
Ejemplo n.º 19
0
        public override AlgebraNode VisitSortAlgebraNode(SortAlgebraNode node)
        {
            ShowPlanElement inputElement = ConvertNode(node.Input);

            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();
            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);

            if (node.Distinct)
                propertyListBuilder.Write(Resources.ShowPlanKeyLogicalOperator, Resources.ShowPlanLogicalOperatorDistinctSort);
            else
                propertyListBuilder.Write(Resources.ShowPlanKeyLogicalOperator, Resources.ShowPlanLogicalOperatorSort);

            propertyListBuilder.Begin(Resources.ShowPlanGroupOrderBy);
            for (int i = 0; i < node.SortEntries.Length; i++)
            {
                string sortOrder = SortOrderToString(node.SortOrders[i]);

                propertyListBuilder.Begin();
                propertyListBuilder.SetGroupValue(String.Format(CultureInfo.InvariantCulture, "{0} {1}", node.SortEntries[i].Name, sortOrder));
                WriteRowBufferEntry(propertyListBuilder, node.SortEntries[i]);
                propertyListBuilder.Write(Resources.ShowPlanKeyOrder, sortOrder);
                propertyListBuilder.End();
            }
            propertyListBuilder.End();

            IList<ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.Sort, properties, inputElement);
            _currentElement = element;

            return node;
        }
Ejemplo n.º 20
0
        public override AlgebraNode VisitTableAlgebraNode(TableAlgebraNode node)
        {
            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();
            propertyListBuilder.Write(Resources.ShowPlanKeyTable, String.Format(CultureInfo.InvariantCulture, "{0} AS {1}", node.TableRefBinding.TableBinding.Name, node.TableRefBinding.Name));
            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);

            IList<ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.TableScan, properties);
            _currentElement = element;

            return node;
        }
Ejemplo n.º 21
0
        public override AstNode VisitTableSpoolRefAlgebraNode(StackedTableSpoolRefAlgebraNode node)
        {
            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();
            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);
            propertyListBuilder.Write(Resources.ShowPlanKeyLogicalOperator, Resources.ShowPlanLogicalOperatorLazySpool);
            propertyListBuilder.Write(Resources.ShowPlanKeyWithStack, Boolean.TrueString);

            IList<ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.TableSpool, properties);
            _currentElement = element;

            return node;
        }
Ejemplo n.º 22
0
        public override AlgebraNode VisitTopAlgebraNode(TopAlgebraNode node)
        {
            ShowPlanElement inputElement = ConvertNode(node.Input);

            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();
            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);

            propertyListBuilder.Write(Resources.ShowPlanKeyLimit, node.Limit.ToString(CultureInfo.InvariantCulture));

            if (node.TieEntries == null)
            {
                propertyListBuilder.Write(Resources.ShowPlanKeyWithTies, Boolean.FalseString);
            }
            else
            {
                propertyListBuilder.Write(Resources.ShowPlanKeyWithTies, Boolean.TrueString);
                AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupTieColumns, node.TieEntries);
            }

            IList<ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.Top, properties, inputElement);
            _currentElement = element;

            return node;
        }
Ejemplo n.º 23
0
        public override AlgebraNode VisitNullScanAlgebraNode(NullScanAlgebraNode node)
        {
            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();
            propertyListBuilder.Write(Resources.ShowPlanKeyEmpty, Boolean.TrueString);
            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);

            IList<ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.ConstantScan, properties);
            _currentElement = element;

            return node;
        }
Ejemplo n.º 24
0
        public override AlgebraNode VisitConcatAlgebraNode(ConcatAlgebraNode node)
        {
            List<ShowPlanElement> inputList = new List<ShowPlanElement>();

            foreach (AlgebraNode inputNode in node.Inputs)
                inputList.Add(ConvertNode(inputNode));

            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();
            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);
            AddDefinedValues(propertyListBuilder, node.DefinedValues);

            IList<ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.Concatenation, properties, inputList.ToArray());
            _currentElement = element;

            return node;
        }
Ejemplo n.º 25
0
        public override AlgebraNode VisitHashMatchAlgebraNode(HashMatchAlgebraNode node)
        {
            ShowPlanElement buildElement = ConvertNode(node.Left);
            ShowPlanElement probeElement = ConvertNode(node.Right);

            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();
            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            AddStatistics(propertyListBuilder, node.StatisticsIterator);

            WriteRowBufferEntry(propertyListBuilder, Resources.ShowPlanKeyHashKeysBuild, node.BuildKeyEntry);
            WriteRowBufferEntry(propertyListBuilder, Resources.ShowPlanKeyHashKeysProbe, node.ProbeEntry);
            propertyListBuilder.Write(Resources.ShowPlanKeyLogicalOperator, LogicalOperatorToString(node.Op));

            if (node.ProbeResidual != null)
                propertyListBuilder.Write(Resources.ShowPlanKeyProbeResidual, node.ProbeResidual.GenerateSource());

            IList<ShowPlanProperty> properties = propertyListBuilder.ToList();

            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.HashMatch, properties, buildElement, probeElement);
            _currentElement = element;

            return node;
        }
Ejemplo n.º 26
0
        public override AlgebraNode VisitJoinAlgebraNode(JoinAlgebraNode node)
        {
            ShowPlanElement leftElement = ConvertNode(node.Left);
            ShowPlanElement rightElement = ConvertNode(node.Right);

            PropertyListBuilder propertyListBuilder = new PropertyListBuilder();
            AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOutputList, node.OutputList);
            propertyListBuilder.Write(Resources.ShowPlanKeyLogicalOperator, LogicalOperatorToString(node.Op));
            AddStatistics(propertyListBuilder, node.StatisticsIterator);

            if (node.Predicate != null)
                propertyListBuilder.Write(Resources.ShowPlanKeyPredicate, node.Predicate.GenerateSource());

            if (node.OuterReferences != null && node.OuterReferences.Length > 0)
                AddRowBufferEntries(propertyListBuilder, Resources.ShowPlanGroupOuterReferences, node.OuterReferences);

            if (node.ProbeBufferEntry != null)
                WriteRowBufferEntry(propertyListBuilder, Resources.ShowPlanKeyProbeColumn, node.ProbeBufferEntry);

            if (node.PassthruPredicate != null)
                propertyListBuilder.Write(Resources.ShowPlanKeyPassthru, node.PassthruPredicate.GenerateSource());

            // We give a warning if a join has no predicate and no outer reference.
            // In this case the join would simply multiply the other side.
            // However, we supppress the warning if any side is known at produce at
            // most one row.
            if (node.Predicate == null &&
                (node.OuterReferences == null || node.OuterReferences.Length == 0) &&
                !AstUtil.WillProduceAtMostOneRow(node.Left) &&
                !AstUtil.WillProduceAtMostOneRow(node.Right))
            {
                propertyListBuilder.Write(Resources.ShowPlanKeyWarning, Resources.ShowPlanWarningNoJoinPredicate);
            }

            IList<ShowPlanProperty> properties = propertyListBuilder.ToList();
            ShowPlanElement element = new ShowPlanElement(ShowPlanOperator.NestedLoops, properties, leftElement, rightElement);
            _currentElement = element;

            return node;
        }