public override Node Visit(ScanViewOp op, Node n)
        {
            //
            // Get the "single" var produced by the input
            //
            var inputVar = GetSingletonVar(n.Child0);
            PlanCompiler.Assert(inputVar != null, "cannot identify Var for the input node to the ScanViewOp");
            // and the table should have exactly one column
            PlanCompiler.Assert(op.Table.Columns.Count == 1, "table for scanViewOp has more than on column?");
            var columnVar = op.Table.Columns[0];

            var definingNode = VisitNode(n.Child0);

            VarInfo varInfo;
            if (!m_varInfoMap.TryGetVarInfo(inputVar, out varInfo))
            {
                PlanCompiler.Assert(false, "didn't find inputVar for scanViewOp?");
            }
            // we must be dealing with a structured column here
            var svarInfo = (StructuredVarInfo)varInfo;

            var typeInfo = m_typeInfo.GetTypeInfo(columnVar.Type);

            // if this view does not represent an entityset, then we're pretty much
            // done. We simply add a mapping from the columnVar to the list of flattened
            // vars produced by the underlying projectOp
            m_varInfoMap.CreateStructuredVarInfo(columnVar, svarInfo.NewType, svarInfo.NewVars, svarInfo.Fields);
            return definingNode;
        }
Ejemplo n.º 2
0
        public override Node Visit(ScanViewOp op, Node n)
        {
            var entityTypeScopePushed = false;
            if (op.Table.TableMetadata.Extent.BuiltInTypeKind
                == BuiltInTypeKind.EntitySet)
            {
                m_entityTypeScopes.Push((EntitySet)op.Table.TableMetadata.Extent);
                entityTypeScopePushed = true;
            }

            HandleTableOpMetadata(op);
            // Ideally, I should call this as the first statement, but that was causing too
            // many test diffs - because of the order in which the entitytypes/sets
            // were being added. There is no semantic difference in calling this here
            VisitRelOpDefault(op, n);

            if (entityTypeScopePushed)
            {
                var scope = m_entityTypeScopes.Pop();
                PlanCompiler.Assert(scope == op.Table.TableMetadata.Extent, "m_entityTypeScopes stack is broken");
            }

            return n;
        }
Ejemplo n.º 3
0
 public override void Visit(ScanViewOp op, Node n)
 {
     VisitRelOpDefault(op, n);
     AssertRelOp(n.Child0.Op);
 }
 /// <summary>
 ///     Visitor pattern method for ScanViewOp
 /// </summary>
 /// <param name="op"> The ScanViewOp being visited </param>
 /// <param name="n"> The Node that references the Op </param>
 public virtual void Visit(ScanViewOp op, Node n)
 {
     VisitTableOp(op, n);
 }
        public override void Visit(ScanViewOp op, Node n)
        {
            PlanCompiler.Assert(op.Table.Columns.Count == 1, "ScanViewOp with multiple columns?");
            var columnVar = op.Table.Columns[0];
            var columnProps = GetPropertyRefList(columnVar);

            var inputVar = NominalTypeEliminator.GetSingletonVar(n.Child0);
            PlanCompiler.Assert(inputVar != null, "cannot determine single Var from ScanViewOp's input");

            AddPropertyRefs(inputVar, columnProps.Clone());

            VisitChildren(n);
        }
Ejemplo n.º 6
0
        // <summary>
        // Copies a ScanViewOp
        // </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(ScanViewOp op, Node n)
        {
            // First create a new ScanViewOp based on the metadata of the existing Op
            var newScan = m_destCmd.CreateScanViewOp(op.Table.TableMetadata);
            // Map the corresponding tables/columns
            MapTable(newScan.Table, op.Table);

            // Create the new node
            Debug.Assert(n.HasChild0);
            var children = ProcessChildren(n);
            return m_destCmd.CreateNode(newScan, children);
        }