-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply document filters to DocumentSet<T> at query time (#378)
Motivation ---------- Some forms of querying using `DocumentSet<T>` properties on an inherited `BucketContext` don't apply document filters such as the `DocumentType` attribute. Modifications ------------- - Split `CollectionQueryable<T>` into two types `CollectionQueryable<T>` and a base `CouchbaseQueryable<T>`. The former is used to represent the original extent of a query against a collection. The latter is used to construct new `IQueryable<T>` instances as the query is extended with predicates, etc. This removes unnecessary fields and logic from the simpler case that is repeated for every new LINQ method applied to the query. - Add an additional non-generic `IDocumentSet` interface which is inherited by `IDocumentSet<T>`. This is a SemVer safe change because it only adds `IQueryable` which was already included on `IDocumentSet<T>` via `IQueryable<T>`. - Create DelayedFilterQueryProvider as a wrapper for ClusterQueryProvider that applies filters to `IDocumentSet` at query execution time. - Refactor query timeouts to always be based on a callback to the `BucketContext` rather than a property, which allows a singleton `ClusterQueryExecutor` per `BucketContext` rather than per query. - Refactor `BucketContext` to build a singleton query provider, query parser, and query executor rather than recreating for every query. - Refactor `DocumentSet<T>` to get the query provider from the `BucketContext`. - Reduce interface invocations by caching the bucket, scope, and collection names once when constructing a `DocumentSet<T>` or `CollectionQueryable<T>` instead of for each property read. - Minor perf and nullable ref type improvements to `DocumentFilterSet`. - Fix some integration tests that were refering to data no longer found in the default `beer-sample` bucket. Results ------- Filters are applied consistently to `DocumentSet<T>` based on the filter configuration at the time the query is run. Queries in all cases will have fewer heap allocations and other CPU performance benefits. Resolves #376
- Loading branch information
1 parent
a999bd2
commit 1cb678c
Showing
15 changed files
with
346 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.