Пример #1
0
        protected override bool CanGenerateColumnar()
        {
            var typeOfTKey    = typeof(TKey);
            var typeOfTSource = typeof(TPayload);
            var typeOfTResult = typeof(TResult);

            if (!typeOfTSource.CanRepresentAsColumnar())
            {
                return(false);
            }
            if (!typeOfTResult.CanRepresentAsColumnar())
            {
                return(false);
            }
            if (typeOfTKey.GetPartitionType() != null)
            {
                return(false);
            }

            var lookupKey = CacheKey.Create(this.Selector.ExpressionToCSharp(), this.HasStartEdge, this.HasKey);

            var generatedPipeType = cachedPipes.GetOrAdd(lookupKey, key => SelectTemplate.Generate(this));

            this.errorMessages = generatedPipeType.Item2;
            return(generatedPipeType.Item1 != null);
        }
Пример #2
0
        private UnaryPipe <TKey, TPayload, TResult> GetPipe(IStreamObserver <TKey, TResult> observer)
        {
            var lookupKey = CacheKey.Create(this.Selector.ExpressionToCSharp(), this.HasStartEdge, this.HasKey);

            var generatedPipeType = cachedPipes.GetOrAdd(lookupKey, key => SelectTemplate.Generate(this));
            Func <PlanNode, IQueryObject, PlanNode> planNode = (PlanNode p, IQueryObject o) => new SelectPlanNode(p, o, typeof(TKey), typeof(TPayload), typeof(TResult), this.Selector, this.HasKey, this.HasStartEdge, true, generatedPipeType.Item2);

            var instance    = Activator.CreateInstance(generatedPipeType.Item1, this, observer, planNode);
            var returnValue = (UnaryPipe <TKey, TPayload, TResult>)instance;

            return(returnValue);
        }