public override void VisitLookupOperator(LookupOperator node)
            {
                node.Parameters.Accept(this);

                // table expression should not see row scope...
                var oldRowScope = _binder._rowScope;

                _binder._rowScope = null;
                try
                {
                    node.Expression.Accept(this);
                }
                finally
                {
                    _binder._rowScope = oldRowScope;
                }

                // condition clause should see both left & right row scopes.
                _binder._rightRowScope = _binder.GetResultType(node.Expression) as TableSymbol;

                try
                {
                    node.LookupClause.Accept(this);

                    // allow right scope to stay for binding of lookup operator node too.
                    BindNode(node);
                }
                finally
                {
                    _binder._rightRowScope = null;
                }
            }
Esempio n. 2
0
            public override void VisitLookupOperator(LookupOperator node)
            {
                base.VisitLookupOperator(node);

                if (node.LookupClause.IsMissing || _position < node.LookupClause.TextStart)
                {
                    // no row scope
                    _binder._rowScope = null;
                }
                else if (_position >= node.LookupClause.TextStart)
                {
                    // this.position >= node.LookupClause.TextStart
                    _binder._rightRowScope = node.Expression.ResultType as TableSymbol;
                }
            }
        /// <summary>
        /// Run operator
        /// </summary>
        /// <returns></returns>
        public override AlgebraOperatorResult Run(IModelMap inMap, IEnumerable <ProjectArgument> inAttributesToProject = null)
        {
            RuleMap = inMap;
            // This operator is quite simple
            // basically a lookup with an empty pipeline (no join condition)
            // No support for embedded entities
            List <MongoDBOperator> OperatorsToExecute = new List <MongoDBOperator>();
            // Fetch rules
            MapRule TargetRule = ModelMap.Rules.First(Rule => Rule.Source.Name == TargetEntity.Element.Name && Rule.IsMain);

            // Create operator
            LookupOperator LookupOp = new LookupOperator(true)
            {
                From     = TargetRule.Target.Name,
                Pipeline = new List <MongoDBOperator>(),
                As       = $"data_{TargetEntity.Element.Name}"
            };

            // Add to list
            OperatorsToExecute.Add(LookupOp);

            return(new AlgebraOperatorResult(OperatorsToExecute));
        }
Esempio n. 4
0
 public override T VisitLookupOperator(LookupOperator node)
 {
     throw new NotImplementedException();
 }