示例#1
0
        private UnaryPipe <TKey, TSource, TResult> GetPipe(IStreamObserver <TKey, TResult> observer)
        {
            var lookupKey = CacheKey.Create(this.Selector.ExpressionToCSharp(), this.HasStartEdge, this.HasKey);

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

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

            return(returnValue);
        }
示例#2
0
        protected override bool CanGenerateColumnar()
        {
            var typeOfTKey    = typeof(TKey);
            var typeOfTSource = typeof(TSource);
            var typeOfTResult = typeof(TResult);

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

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

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

            this.errorMessages = generatedPipeType.Item2;
            return(generatedPipeType.Item1 != null);
        }