[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: query profiling #1870

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use generic type.
  • Loading branch information
ehsannas committed Jul 31, 2023
commit 43a4ec3a801d49020a211b095a95f4ad8313e86b
49 changes: 0 additions & 49 deletions dev/src/profiling.ts

This file was deleted.

5 changes: 2 additions & 3 deletions dev/src/reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ import {DocumentWatch, QueryWatch} from './watch';
import {validateDocumentData, WriteBatch, WriteResult} from './write-batch';
import api = protos.google.firestore.v1;
import {CompositeFilter, Filter, UnaryFilter} from './filter';
import {QueryProfileInfo, AggregateQueryProfileInfo} from './profiling';

/**
* The direction of a `Query.orderBy()` clause is specified as 'desc' or 'asc'
Expand Down Expand Up @@ -2231,7 +2230,7 @@ export class Query<T = firestore.DocumentData> implements firestore.Query<T> {
* @return A Promise that will be resolved with the planning information,
* statistics from the query execution, and the query results.
*/
profile(): Promise<firestore.QueryProfileInfo<T>> {
profile(): Promise<firestore.QueryProfileInfo<QuerySnapshot<T>>> {
const mock = {
plan: {foo: 'bar'},
stats: {cpu: '3ms'},
Expand Down Expand Up @@ -3325,7 +3324,7 @@ export class AggregateQuery<T extends firestore.AggregateSpec>
return Promise.resolve({foo: 'bar'});
}

profile(): Promise<firestore.AggregateQueryProfileInfo<T>> {
profile(): Promise<firestore.QueryProfileInfo<AggregateQuerySnapshot<T>>> {
const mock = {
plan: {foo: 'bar'},
stats: {cpu: '3ms'},
Expand Down
31 changes: 4 additions & 27 deletions types/firestore.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1726,7 +1726,7 @@ declare namespace FirebaseFirestore {
* @return A Promise that will be resolved with the planning information,
* statistics from the query execution, and the query results.
*/
profile(): Promise<QueryProfileInfo<T>>;
profile(): Promise<QueryProfileInfo<QuerySnapshot<T>>>;

/*
* Executes the query and returns the results as Node Stream.
Expand Down Expand Up @@ -2158,7 +2158,7 @@ declare namespace FirebaseFirestore {
* @return A Promise that will be resolved with the planning information,
* statistics from the query execution, and the query results.
*/
profile(): Promise<AggregateQueryProfileInfo<T>>;
profile(): Promise<QueryProfileInfo<AggregateQuerySnapshot<T>>>;

/**
* Compares this object with the given object for equality.
Expand Down Expand Up @@ -2593,7 +2593,7 @@ declare namespace FirebaseFirestore {
}

/** A QueryProfileInfo contains information about planning, execution, and results of a query. */
export interface QueryProfileInfo<T extends DocumentData> {
export interface QueryProfileInfo<T> {
/**
* A Map that contains information about the query plan.
* Contents are subject to change.
Expand All @@ -2609,30 +2609,7 @@ declare namespace FirebaseFirestore {
/**
* The snapshot that contains the results of executing the query.
*/
readonly snapshot: QuerySnapshot<T>;
}

/**
* An AggregateQueryProfileInfo contains information about planning,
* execution, and results of an aggregate query.
*/
export interface AggregateQueryProfileInfo<T extends AggregateSpec> {
/**
* A Map that contains information about the query plan.
* Contents are subject to change.
*/
readonly plan: Record<string, unknown>;

/**
* A Map that contains statistics about the execution of the aggregate query.
* Contents are subject to change.
*/
readonly stats: Record<string, unknown>;

/**
* The snapshot that contains the results of executing the aggregate query.
*/
readonly snapshot: AggregateQuerySnapshot<T>;
readonly snapshot: T;
}
}

Expand Down
Loading