public override Node Visit(UnnestOp op, Node n)
        {
            List <Node> args     = this.ProcessChildren(n);
            UnnestOp    unnestOp = this.m_destCmd.CreateUnnestOp(this.GetMappedVar(op.Var), this.m_destCmd.CreateTableInstance(op.Table.TableMetadata));

            this.MapTable(unnestOp.Table, op.Table);
            return(this.m_destCmd.CreateNode((Op)unnestOp, args));
        }
Exemplo n.º 2
0
        public override void Visit(UnnestOp op, Node n)
        {
            var attrs = new Dictionary <string, object>();

            if (null != op.Var)
            {
                attrs.Add("Var", op.Var.Id);
            }
            using (new AutoXml(this, op, attrs))
            {
                DumpTable(op.Table);
                VisitChildren(n);
            }
        }
Exemplo n.º 3
0
        public override void Visit(UnnestOp op, Node n)
        {
            Dictionary <string, object> attrs = new Dictionary <string, object>();

            if (op.Var != null)
            {
                attrs.Add("Var", (object)op.Var.Id);
            }
            using (new Dump.AutoXml(this, (Op)op, attrs))
            {
                this.DumpTable(op.Table);
                this.VisitChildren(n);
            }
        }
Exemplo n.º 4
0
        // <summary>
        // Clone an UnnestOp
        // </summary>
        // <param name="op"> The Op to Copy </param>
        // <param name="n"> The Node that references the Op </param>
        // <returns> A copy of the original Node that references a copy of the original Op </returns>
        public override Node Visit(UnnestOp op, Node n)
        {
            // Visit the Node's children and map their Vars
            var children = ProcessChildren(n);

            // Get the mapped unnest-var
            var mappedVar = GetMappedVar(op.Var);

            // Create a new unnestOp
            var newTable  = m_destCmd.CreateTableInstance(op.Table.TableMetadata);
            var newUnnest = m_destCmd.CreateUnnestOp(mappedVar, newTable);

            // Map the corresponding tables/columns
            MapTable(newUnnest.Table, op.Table);

            // create the unnest node
            return(m_destCmd.CreateNode(newUnnest, children));
        }
Exemplo n.º 5
0
        /// <summary>
        ///     Computes a NodeInfo for an UnnestOp.
        ///     Definitions = columns of the table produced by this Op
        ///     Keys = none
        ///     External References = the unnestVar + any external references of the
        ///     computed Var (if any)
        ///     RowCount (default): MinRows = 0; MaxRows = *
        ///     NonNullableDefinitions: default(empty)
        ///     NonNullableInputDefinitions : default(empty) because cannot be used
        /// </summary>
        public override NodeInfo Visit(UnnestOp op, Node n)
        {
            var nodeInfo = InitExtendedNodeInfo(n);

            foreach (var v in op.Table.Columns)
            {
                nodeInfo.LocalDefinitions.Set(v);
                nodeInfo.Definitions.Set(v);
            }

            // Process keys if it's a TVF with inferred keys, otherwise - no keys.
            if (n.Child0.Op.OpType == OpType.VarDef &&
                n.Child0.Child0.Op.OpType == OpType.Function &&
                op.Table.Keys.Count > 0)
            {
                // This is a TVF case.
                // Get table's keys - but only if they have been referenced.
                if (op.Table.ReferencedColumns.Subsumes(op.Table.Keys))
                {
                    nodeInfo.Keys.InitFrom(op.Table.Keys);
                }
            }
            else
            {
                // no keys
                Debug.Assert(nodeInfo.Keys.NoKeys, "UnnestOp should have no keys in all cases except TVFs mapped to entities.");
            }

            // If I have a child, then my external references are my child's external references.
            // Otherwise, my external reference is my unnestVar
            if (n.HasChild0)
            {
                var childNodeInfo = GetNodeInfo(n.Child0);
                nodeInfo.ExternalReferences.Or(childNodeInfo.ExternalReferences);
            }
            else
            {
                nodeInfo.ExternalReferences.Set(op.Var);
            }

            return(nodeInfo);
        }
        public override NodeInfo Visit(UnnestOp op, Node n)
        {
            ExtendedNodeInfo extendedNodeInfo = this.InitExtendedNodeInfo(n);

            foreach (Var column in (List <Var>)op.Table.Columns)
            {
                extendedNodeInfo.LocalDefinitions.Set(column);
                extendedNodeInfo.Definitions.Set(column);
            }
            if (n.Child0.Op.OpType == OpType.VarDef && n.Child0.Child0.Op.OpType == OpType.Function && (op.Table.Keys.Count > 0 && op.Table.ReferencedColumns.Subsumes(op.Table.Keys)))
            {
                extendedNodeInfo.Keys.InitFrom((IEnumerable <Var>)op.Table.Keys);
            }
            if (n.HasChild0)
            {
                NodeInfo nodeInfo = this.GetNodeInfo(n.Child0);
                extendedNodeInfo.ExternalReferences.Or(nodeInfo.ExternalReferences);
            }
            else
            {
                extendedNodeInfo.ExternalReferences.Set(op.Var);
            }
            return((NodeInfo)extendedNodeInfo);
        }
 public virtual void Visit(UnnestOp op, Node n)
 {
     this.VisitRelOpDefault((RelOp)op, n);
 }
Exemplo n.º 8
0
 public override void Visit(UnnestOp op, Node n)
 {
     VisitRelOpDefault(op, n);
     AssertOpType(n.Child0.Op, OpType.VarDef);
 }
Exemplo n.º 9
0
 /// <summary>
 ///     Visitor pattern method for UnnestOp
 /// </summary>
 /// <param name="op"> The UnnestOp being visited </param>
 /// <param name="n"> The Node that references the Op </param>
 public virtual void Visit(UnnestOp op, Node n)
 {
     VisitRelOpDefault(op, n);
 }
Exemplo n.º 10
0
 // <summary>
 // UnnestOp
 // </summary>
 public virtual TResultType Visit(UnnestOp op, Node n)
 {
     return(VisitRelOpDefault(op, n));
 }