Skip to content

Commit f6b826b

Browse files
Luke OsborneLuke Osborne
authored andcommitted
Support 'limit' with show proxied queries
This truncates the output of `show proxied queries limit n` to n rows. The truncation happens after our sorting so tha the top n rows are the "most useful" ones as determined by our sorting. Release-Note-Core: You can now limit the number of rows returned by `show proxied queries` by adding a 'limit n' clause. Change-Id: I8b3f877f2c299f5daf139e9a8cab8ea9c0e1839e Reviewed-on: https://gerrit.readyset.name/c/readyset/+/6265 Tested-by: Buildkite CI Reviewed-by: Jason Brown <[email protected]>
1 parent 9bf1cc0 commit f6b826b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

readyset-adapter/src/backend.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,6 +1804,7 @@ where
18041804
&mut self,
18051805
query_id: &Option<String>,
18061806
only_supported: bool,
1807+
limit: Option<u64>,
18071808
) -> ReadySetResult<noria_connector::QueryResult<'static>> {
18081809
let mut queries = self.state.query_status_cache.deny_list();
18091810
if let Some(q_id) = query_id {
@@ -1898,6 +1899,10 @@ where
18981899
}
18991900
});
19001901

1902+
if let Some(limit) = limit {
1903+
data.truncate(limit as usize);
1904+
}
1905+
19011906
Ok(noria_connector::QueryResult::from_owned(
19021907
select_schema,
19031908
vec![Results::new(data)],
@@ -2102,6 +2107,7 @@ where
21022107
self.show_proxied_queries(
21032108
&proxied_queries_options.query_id,
21042109
proxied_queries_options.only_supported,
2110+
proxied_queries_options.limit,
21052111
)
21062112
.await
21072113
}

0 commit comments

Comments
 (0)