예제 #1
0
        public override void DetermineDataType(Plan plan)
        {
            DetermineModifiers(plan);
            _dataType = new Schema.RowType();

            foreach (Schema.Column column in SourceRowType.Columns)
            {
                DataType.Columns.Add(column.Copy());
            }
            _extendColumnOffset = DataType.Columns.Count;

            plan.EnterRowContext();
            try
            {
                plan.Symbols.Push(new Symbol(String.Empty, SourceRowType));
                try
                {
                    // Add a column for each expression
                    PlanNode      planNode;
                    Schema.Column newColumn;
                    foreach (NamedColumnExpression column in _expressions)
                    {
                        planNode = Compiler.CompileExpression(plan, column.Expression);

                        newColumn =
                            new Schema.Column
                            (
                                column.ColumnAlias,
                                planNode.DataType
                            );

                        DataType.Columns.Add(newColumn);
                        Nodes.Add(planNode);
                    }
                }
                finally
                {
                    plan.Symbols.Pop();
                }
            }
            finally
            {
                plan.ExitRowContext();
            }
        }