public final class Query<T> implements Queryable<T>:
Immutable, lazy and re-executable typed KQL query.
A query is not a collection. Execution occurs only through an explicit terminal operation such as toList(), count(), or stream().
active = query: from users user where user.active rows = active.toList()
| Modifier and Type | Member | Description |
|---|---|---|
| public | QueryQuery(source as QuerySource, plan as QueryPlanBase, description as String = "query"): |
Creates a lazy query from a provider source and immutable typed plan. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | asQueryasQuery() as Query<T>: |
Returns this immutable query. |
| public | countcount() as Long: |
Counts result rows through the provider count operation. |
| public | countPlancountPlan(plan as QueryPlanBase) as Long: |
Counts rows produced by an outer plan. |
| public | executePlanexecutePlan(plan as QueryPlanBase) as Object: |
Applies an outer typed plan to this query. |
| public | existsexists() as Boolean: |
Tests whether at least one row exists. |
| public | existsPlanexistsPlan(plan as QueryPlanBase) as Boolean: |
Tests whether an outer plan produces a row. |
| public | explainexplain() as QueryExplanation: |
Returns a typed, redacted query explanation. |
| public | firstfirst() as T throws NoResultException: |
Returns the first row using a one-row provider window. |
| public | firstOrNullfirstOrNull() as T: |
Returns the first row or null. |
| public | openStreamopenStream(plan as QueryPlanBase) as Object: |
Opens an outer plan as an independent sequential stream. |
| public | pagepage(request as PageRequest) as Page<T>: |
Materializes one page and obtains an exact total count. |
| public | providerNameproviderName() as String: |
Returns the underlying provider identifier. |
| public | providerTextproviderText(plan as QueryPlanBase) as String: |
Returns provider text and explicitly identifies composed memory work. |
| public | singlesingle() as T throws NoResultException, NonUniqueResultException: |
Returns the sole result row. |
| public | singleOrNullsingleOrNull() as T throws NonUniqueResultException: |
Returns the sole row or null. |
| public | sliceslice(request as PageRequest) as Slice<T>: |
Materializes one page window without executing an exact count. |
| public | streamstream() as QueryStream<T>: |
Opens one independent forward-only result stream. |
| public | toListtoList() as List<T>: |
Executes and materializes the query into the standard list type. |
| public | toProviderTexttoProviderText() as String: |
Returns the privileged provider representation for diagnostics. |
| public | toSettoSet() as Set<T>: |
Executes and materializes unique result rows. |