示例#1
0
 public SubordPropRangeKeyForge(
     QueryGraphValueEntryRangeForge rangeInfo,
     Type coercionType)
 {
     RangeInfo = rangeInfo;
     CoercionType = coercionType;
 }
 public override string ToString()
 {
     return "CompositeTableLookupPlan " +
            base.ToString() +
            " directKeys=" +
            QueryGraphValueEntryHashKeyedForge.ToQueryPlan(_hashKeys) +
            " rangeKeys=" +
            QueryGraphValueEntryRangeForge.ToQueryPlan(_rangeKeyPairs);
 }
示例#3
0
 public HistoricalIndexLookupStrategySortedForge(
     int lookupStream,
     QueryGraphValueEntryRangeForge range,
     Type coercionType)
 {
     this.lookupStream = lookupStream;
     this.range = range;
     this.coercionType = coercionType;
 }
示例#4
0
 public override string ToString()
 {
     return "TableLookupKeyDesc{" +
            "hash=" +
            QueryGraphValueEntryHashKeyedForge.ToQueryPlan(Hashes) +
            ", btree=" +
            QueryGraphValueEntryRangeForge.ToQueryPlan(Ranges) +
            '}';
 }
示例#5
0
 public SortedTableLookupPlanForge(
     int lookupStream,
     int indexedStream,
     bool indexedStreamIsVDW,
     EventType[] typesPerStream,
     TableLookupIndexReqKey indexNum,
     QueryGraphValueEntryRangeForge rangeKeyPair,
     Type optionalCoercionType)
     :
     base(lookupStream, indexedStream, indexedStreamIsVDW, typesPerStream, new[] {indexNum})
 {
     RangeKeyPair = rangeKeyPair;
     this.optionalCoercionType = optionalCoercionType;
 }
示例#6
0
        public CodegenExpression Make(
            CodegenMethodScope parent,
            SAIFFInitializeSymbol symbols,
            CodegenClassScope classScope)
        {
            var method = parent.MakeChild(TypeOfPlanFactory(), GetType(), classScope);
            IList<CodegenExpression> @params = new List<CodegenExpression>(6);
            @params.Add(Constant(lookupStream));
            @params.Add(Constant(indexedStream));
            @params.Add(
                CodegenMakeableUtil.MakeArray(
                    "reqIdxKeys",
                    typeof(TableLookupIndexReqKey),
                    IndexNum,
                    GetType(),
                    method,
                    symbols,
                    classScope));
            @params.AddAll(AdditionalParams(method, symbols, classScope));
            method.Block
                .DeclareVar(TypeOfPlanFactory(), "plan", NewInstance(TypeOfPlanFactory(), @params.ToArray()));

            // inject additional information for virtual data windows
            if (indexedStreamIsVDW) {
                var keyDesc = KeyDescriptor;
                var hashes = keyDesc.HashExpressions;
                var ranges = keyDesc.Ranges.ToArray();
                var rangeResults = QueryGraphValueEntryRangeForge.GetRangeResultTypes(ranges);
                method.Block
                    .SetProperty(
                        Ref("plan"),
                        "VirtualDWHashEvals",
                        ExprNodeUtilityCodegen.CodegenEvaluators(hashes, method, GetType(), classScope))
                    .SetProperty(
                        Ref("plan"),
                        "VirtualDWHashTypes",
                        Constant(ExprNodeUtilityQuery.GetExprResultTypes(hashes)))
                    .SetProperty(
                        Ref("plan"),
                        "VirtualDWRangeEvals",
                        QueryGraphValueEntryRangeForge.MakeArray(ranges, method, symbols, classScope))
                    .SetProperty(Ref("plan"), "VirtualDWRangeTypes", Constant(rangeResults));
            }

            method.Block.MethodReturn(Ref("plan"));
            return LocalMethod(method);
        }
示例#7
0
        public CodegenExpression Make(
            CodegenMethodScope parent,
            SAIFFInitializeSymbol symbols,
            CodegenClassScope classScope)
        {
            var hashes = new ExprNode[_hashKeys.Count];
            var hashTypes = new Type[_hashKeys.Count];
            for (var i = 0; i < _hashKeys.Count; i++) {
                hashes[i] = _hashKeys[i].HashKey.KeyExpr;
                hashTypes[i] = _hashKeyCoercionTypes.CoercionTypes[i];
            }

            var ranges = new QueryGraphValueEntryRangeForge[_rangeKeys.Count];
            var rangesTypes = new Type[_rangeKeys.Count];
            for (var i = 0; i < _rangeKeys.Count; i++) {
                ranges[i] = _rangeKeys[i].RangeInfo;
                rangesTypes[i] = _rangeKeyCoercionTypes.CoercionTypes[i];
            }

            var builder = new SAIFFInitializeBuilder(
                typeof(SubordTableLookupStrategyFactoryVDW),
                GetType(),
                "lookup",
                parent,
                symbols,
                classScope);
            builder
                .Expression("indexHashedProps", IndexedPropDesc.MakeArray(_hashAndRanges.HashedProps))
                .Expression("indexBtreeProps", IndexedPropDesc.MakeArray(_hashAndRanges.BtreeProps))
                .Constant("IsNwOnTrigger", _nwOnTrigger)
                .Constant("NumOuterStreams", _outerStreams.Length)
                .Expression(
                    "hashEvals",
                    ExprNodeUtilityCodegen.CodegenEvaluators(hashes, builder.Method(), GetType(), classScope))
                .Constant("HashCoercionTypes", hashTypes)
                .Expression(
                    "rangeEvals",
                    QueryGraphValueEntryRangeForge.MakeArray(ranges, builder.Method(), symbols, classScope))
                .Constant("RangeCoercionTypes", rangesTypes);
            return builder.Build();
        }
 private static void CompareIndexDescRange(
     QueryGraphValueEntryRangeForge expected,
     QueryGraphValueEntryRangeForge actual)
 {
     Assert.AreEqual(expected.ToQueryPlan(), actual.ToQueryPlan());
 }