Exemple #1
0
        internal virtual ColumnVar CreateColumnVar(Table table, ColumnMD columnMD)
        {
            ColumnVar columnVar = new ColumnVar(this.NewVarId(), table, columnMD);

            table.Columns.Add((Var)columnVar);
            this.m_vars.Add((Var)columnVar);
            return(columnVar);
        }
        private void DumpVar(Var v)
        {
            Dictionary <string, object> attrs = new Dictionary <string, object>();

            attrs.Add("Var", (object)v.Id);
            ColumnVar columnVar = v as ColumnVar;

            if (columnVar != null)
            {
                attrs.Add("Name", (object)columnVar.ColumnMetadata.Name);
                attrs.Add("Type", (object)columnVar.ColumnMetadata.Type.ToString());
            }
            using (new Dump.AutoXml(this, v.GetType().Name, attrs))
                ;
        }
        internal Table(Command command, TableMD tableMetadata, int tableId)
        {
            this.m_tableMetadata      = tableMetadata;
            this.m_columns            = Command.CreateVarList();
            this.m_keys               = command.CreateVarVec();
            this.m_nonnullableColumns = command.CreateVarVec();
            this.m_tableId            = tableId;
            Dictionary <string, ColumnVar> dictionary = new Dictionary <string, ColumnVar>();

            foreach (ColumnMD column in tableMetadata.Columns)
            {
                ColumnVar columnVar = command.CreateColumnVar(this, column);
                dictionary[column.Name] = columnVar;
                if (!column.IsNullable)
                {
                    this.m_nonnullableColumns.Set((Var)columnVar);
                }
            }
            foreach (ColumnMD key in tableMetadata.Keys)
            {
                this.m_keys.Set((Var)dictionary[key.Name]);
            }
            this.m_referencedColumns = command.CreateVarVec((IEnumerable <Var>) this.m_columns);
        }
Exemple #4
0
 // <summary>
 // Add a new "equi-join" condition to this edge
 // </summary>
 // <param name="joinNode"> join node producing this condition </param>
 // <param name="leftVar"> the left-side column </param>
 // <param name="rightVar"> the right-side column </param>
 // <returns> true, if this condition can be added </returns>
 internal bool AddCondition(AugmentedJoinNode joinNode, ColumnVar leftVar, ColumnVar rightVar)
 {
     if (joinNode != m_joinNode)
     {
         return false;
     }
     m_leftVars.Add(leftVar);
     m_rightVars.Add(rightVar);
     return true;
 }
Exemple #5
0
        internal static JoinEdge CreateJoinEdge(
            AugmentedTableNode left, AugmentedTableNode right,
            AugmentedJoinNode joinNode,
            ColumnVar leftVar, ColumnVar rightVar)
        {
            var leftVars = new List<ColumnVar>();
            var rightVars = new List<ColumnVar>();
            leftVars.Add(leftVar);
            rightVars.Add(rightVar);

            var joinOpType = joinNode.Node.Op.OpType;
            PlanCompiler.Assert(
                (joinOpType == OpType.LeftOuterJoin || joinOpType == OpType.InnerJoin),
                "Unexpected join type for join edge: " + joinOpType);

            var joinKind = joinOpType == OpType.LeftOuterJoin ? JoinKind.LeftOuter : JoinKind.Inner;

            var joinEdge = new JoinEdge(left, right, joinNode, joinKind, leftVars, rightVars);
            return joinEdge;
        }
Exemple #6
0
 // <summary>
 // Creates a new var for a table column
 // </summary>
 // <param name="table"> The table instance that produces the column </param>
 // <param name="columnMD"> column metadata </param>
 // <returns> A new ColumnVar instance that references the specified column in the given table </returns>
 internal virtual ColumnVar CreateColumnVar(Table table, ColumnMD columnMD)
 {
     // create a new column var now
     var c = new ColumnVar(NewVarId(), table, columnMD);
     table.Columns.Add(c);
     m_vars.Add(c);
     return c;
 }