Пример #1
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);
        }
Пример #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);
        }
Пример #3
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);
        }
Пример #4
0
        private static void AddStatistics(PropertyListBuilder builder, StatisticsIterator iterator)
        {
            if (iterator != null)
            {
                int openCount   = iterator.OpenCount;
                int rowCount    = iterator.RowCount;
                int avgRowCount = (openCount == 0) ? 0 : (int)Math.Round(rowCount / (double)openCount, 0);

                builder.Begin(Resources.ShowPlanGroupStatistics);
                builder.Write(Resources.ShowPlanKeyStatisticsOpenCount, openCount.ToString("N0", CultureInfo.InvariantCulture));
                builder.Write(Resources.ShowPlanKeyStatisticsRowCount, rowCount.ToString("N0", CultureInfo.InvariantCulture));
                builder.Write(Resources.ShowPlanKeyStatisticsAverageRowCount, avgRowCount.ToString("N0", CultureInfo.InvariantCulture));
                builder.End();
            }
        }
Пример #5
0
        private static void WriteRowBufferEntry(PropertyListBuilder builder, RowBufferEntry rowBufferColumn)
        {
            string[] parts = rowBufferColumn.Name.Split('.');
            if (parts.Length != 2)
            {
                builder.Write(Resources.ShowPlanKeyColumn, rowBufferColumn.Name);
            }
            else
            {
                builder.Write(Resources.ShowPlanKeyTable, parts[0]);
                builder.Write(Resources.ShowPlanKeyColumn, parts[1]);
            }

            builder.Write(Resources.ShowPlanKeyDataType, rowBufferColumn.DataType.Name);
        }
Пример #6
0
        private static void AddDefinedValues(PropertyListBuilder builder, IEnumerable <ComputedValueDefinition> definedValues)
        {
            builder.Begin(Resources.ShowPlanGroupDefinedValues);

            foreach (ComputedValueDefinition definedValue in definedValues)
            {
                string sourceExpression = definedValue.Expression.GenerateSource();
                builder.Begin();
                builder.SetGroupValue(String.Format(CultureInfo.InvariantCulture, "{0} = {1}", definedValue.Target.Name, sourceExpression));
                builder.Write(Resources.ShowPlanKeyTarget, definedValue.Target.Name);
                builder.Write(Resources.ShowPlanKeyDataType, definedValue.Target.DataType.Name);
                builder.Write(Resources.ShowPlanKeySource, sourceExpression);
                builder.End();
            }
            builder.End();
        }
Пример #7
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);
        }
Пример #8
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);
        }
Пример #9
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);
        }
Пример #10
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);
        }
Пример #11
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);
        }
Пример #12
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);
        }
Пример #13
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;
        }
Пример #14
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);
        }
Пример #15
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;
        }
Пример #16
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;
        }
Пример #17
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;
        }
Пример #18
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;
        }
Пример #19
0
        private static void WriteRowBufferEntry(PropertyListBuilder builder, RowBufferEntry rowBufferColumn)
        {
            string[] parts = rowBufferColumn.Name.Split('.');
            if (parts.Length != 2)
            {
                builder.Write(Resources.ShowPlanKeyColumn, rowBufferColumn.Name);
            }
            else
            {
                builder.Write(Resources.ShowPlanKeyTable, parts[0]);
                builder.Write(Resources.ShowPlanKeyColumn, parts[1]);
            }

            builder.Write(Resources.ShowPlanKeyDataType, rowBufferColumn.DataType.Name);
        }
Пример #20
0
        private static void AddStatistics(PropertyListBuilder builder, StatisticsIterator iterator)
        {
            if (iterator != null)
            {
                int openCount = iterator.OpenCount;
                int rowCount = iterator.RowCount;
                int avgRowCount = (openCount == 0) ? 0 : (int) Math.Round(rowCount /(double)openCount, 0);

                builder.Begin(Resources.ShowPlanGroupStatistics);
                builder.Write(Resources.ShowPlanKeyStatisticsOpenCount, openCount.ToString("N0", CultureInfo.InvariantCulture));
                builder.Write(Resources.ShowPlanKeyStatisticsRowCount, rowCount.ToString("N0", CultureInfo.InvariantCulture));
                builder.Write(Resources.ShowPlanKeyStatisticsAverageRowCount, avgRowCount.ToString("N0", CultureInfo.InvariantCulture));
                builder.End();
            }
        }
Пример #21
0
        private static void AddDefinedValues(PropertyListBuilder builder, IEnumerable<AggregatedValueDefinition> definedValues)
        {
            builder.Begin(Resources.ShowPlanGroupDefinedValues);

            foreach (AggregatedValueDefinition definedValue in definedValues)
            {
                string source = String.Format(CultureInfo.InvariantCulture,
                                              "{0}({1})",
                                              definedValue.Aggregate.Name,
                                              definedValue.Argument.GenerateSource());

                builder.Begin();
                builder.SetGroupValue(String.Format(CultureInfo.InvariantCulture, "{0} = {1}", definedValue.Target.Name, source));
                builder.Write(Resources.ShowPlanKeyTarget, definedValue.Target.Name);
                builder.Write(Resources.ShowPlanKeyDataType, definedValue.Target.DataType.Name);
                builder.Write(Resources.ShowPlanKeySource, source);
                builder.End();
            }

            builder.End();
        }
Пример #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;
        }
Пример #23
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;
        }
Пример #24
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;
        }
Пример #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;
        }
Пример #26
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;
        }