-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
infoschema,planner: implement the metric table predicate push down #14169
Conversation
|
||
func (e *MetricTableExtractor) convertToTime(t int64) time.Time { | ||
if t == 0 || t == math.MaxInt64 { | ||
return time.Now() |
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.
What if startTime=0, endTime=now-1h?
You changed it to [now, now-1h].
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.
Yes, but it will got error when query.
mysql>desc select * from query_duration where `Quantile` in ( 0.99) and sql_type="internal" and time < "2019-12-23 16:10:13" and instance="127.0.0.1:10080";
+----------------+----------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id | count | task | operator info |
+----------------+----------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| MemTableScan_5 | 10000.00 | root | PromQL:histogram_quantile(0.99, sum(rate(tidb_server_handle_query_duration_seconds_bucket{instance="127.0.0.1:10080",sql_type="internal"}[60s])) by (le)), start_time:2019-12-23 16:20:47.559, end_time:2019-12-23 16:10:12, step:1m0s |
+----------------+----------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set
Time: 0.009s
mysql>select * from query_duration where `Quantile` in ( 0.99) and sql_type="internal" and time < "2019-12-23 16:10:13" and instance="127.0.0.1:10080";
(1105, u'bad_data: end timestamp must not be before start time')
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 mean, it shouldn't return an error.
When user queries [0, 16:10], you can change it to [13:40, 16:10], not [16:20, 16:10].
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.
addressed. But When the user queries [0, 16:10], it will change it to [16:10, 16:10] now.
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.
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.
ok, done
fd13db4
to
56ecbc6
Compare
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.
Rest LGTM
/run-all-tests |
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.
LGTM
/run-unit-test |
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.
LGTM
What problem does this PR solve?
What is changed and how it works?
Check List
Tests
Code changes