-
Notifications
You must be signed in to change notification settings - Fork 83
feat: query profiling part 1: synchronous #938
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
Changes from 1 commit
efec02f
886c3b8
4dde816
431db7f
1ebcb56
7338db9
ca6adc1
05d7578
dc97653
75377fc
60acc88
422d966
bb12421
83e62bb
b53805d
c11f382
841a754
a5748b2
920db4b
7023417
1842709
74db4fe
8a4c5e4
e7dda7c
e61815f
23b88b9
7912c95
aa7b3d9
46e5139
299af43
41fd646
ca631ec
10cc536
697775d
30e5efc
981a644
28abbf2
9ce86be
dff947e
4019d64
978268b
c293787
6fc1600
a4e87bf
cb693f8
7439e76
bb60ce0
6f86854
05424bf
5e15e6a
0906d65
ccbb623
843dc05
066ead5
f542ac1
5fb71dd
8b82957
a400f6f
12d18c0
9bf8b00
7ae1028
f08a35d
560ba95
4955a0b
1293a36
bd18af2
ab9e3bf
fa45e05
bb172be
d231424
765420a
71bde2a
cf89254
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,11 +18,12 @@ | |
| QueryExplainError, | ||
| ) | ||
|
|
||
| from typing import List, Optional, TypeVar | ||
|
|
||
| from typing import List, Optional | ||
| T = TypeVar("T") | ||
Linchin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| class QueryResultsList(list): | ||
| class QueryResultsList(List[T]): | ||
| """A list of received query results from the query call. | ||
|
|
||
| This is a subclass of the built-in list. A new property `explain_metrics` | ||
|
|
@@ -68,4 +69,4 @@ def get_explain_metrics(self) -> ExplainMetrics: | |
| if self._explain_options is None: | ||
| raise QueryExplainError("explain_options not set on query.") | ||
| else: | ||
| return self._explain_metrics | ||
| return self._explain_metrics # type: ignore | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,7 +30,7 @@ | |
| T = TypeVar("T") | ||
|
|
||
|
|
||
| class StreamGenerator(Generator[T, Any, None]): | ||
| class StreamGenerator(Generator[T, Any, Optional[ExplainMetrics]]): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It looks like this passes the check: This should be backwards compatible, since we're just adding new optional arguments. All existing code should be unaffected Honestly though, I think removing the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right, we shouldn't let
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Additionally, python 3.12 has deprecated parameters |
||
| """Generator for the streamed results. | ||
Linchin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Args: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason it inlcludes that Coroutine part is because this method is overridden by the
asyncmethod in the async subclass, which implicitly wraps its output in a coroutine. Mypy raises an issue for this issue in async_aggregation:But that said, I did some research, and I don't think the old solution of adding
CoroutineorAwaitableas a return option actually works for mypy. I'd say maybe you should leave the return annotation mostly how it was for now, and we can find a better solution when we fix types laterThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, but after trying it out I think both
Coroutine[Any, Any, List[List[AggregationResult]]]andAwaitable[List[List[AggregationResult]]]work? (maybe I'm missing something)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what I see:
But if you found it works for you, that's fine with me too! Either way, I think this can fall into the known-broken mypy issues to fix later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, I will revert the change and save this for later haha