protected override Task <IQueryable <Customer> > GetQueryableData(IQueryOptions <Customer> queryOptions, ICustomMetadata customMetadata) { if (queryOptions.TryGetEqualFiltersForProperty(x => x.Custkey, out var filters)) { List <Customer> output = new List <Customer>(); foreach (var val in filters) { if (_tpchData.CustomerKeyIndex.TryGetValue(val, out var customer)) { output.Add(customer); } } return(Task.FromResult(output.AsQueryable())); } return(Task.FromResult(_tpchData.Customers.AsQueryable())); }
protected override Task <IQueryable <IndexTest> > GetQueryableData(IQueryOptions <IndexTest> queryOptions, ICustomMetadata customMetadata) { IQueryable <IndexTest> queryable; IReadOnlyDictionary <long, IndexTest> dict; if (queryOptions.Parameters.TryGetParameter("indexSize", out var indexSizeParameter) && indexSizeParameter.TryGetValue <long>(out var indexSize)) { (queryable, dict) = TestData.GetIndexTestData(indexSize); } else { (queryable, dict) = TestData.GetIndexTestData(1000000); } if (queryOptions.Parameters.TryGetParameter("useIndex", out var useIndexParameter)) { if (useIndexParameter.TryGetValue <bool>(out var useIndex)) { if (queryOptions.TryGetEqualFiltersForProperty(x => x.Key, out var filters)) { List <IndexTest> output = new List <IndexTest>(); foreach (var val in filters) { if (dict.TryGetValue(val, out var obj)) { output.Add(obj); } } return(Task.FromResult(output.AsQueryable())); } } } return(Task.FromResult(queryable)); }