File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
main/java/com/clickhouse/client/api/query
test/java/com/clickhouse/client/query Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,15 @@ public long getResultRows() {
133133 return operationMetrics .getMetric (ServerMetrics .RESULT_ROWS ).getLong ();
134134 }
135135
136+
137+ /**
138+ * Alias for {@link ServerMetrics#TOTAL_ROWS_TO_READ}
139+ * @return estimated number of rows to read
140+ */
141+ public long getTotalRowsToRead () {
142+ return operationMetrics .getMetric (ServerMetrics .TOTAL_ROWS_TO_READ ).getLong ();
143+ }
144+
136145 /**
137146 * Alias for {@link OperationMetrics#getQueryId()}
138147 * @return query id of the request
Original file line number Diff line number Diff line change @@ -2018,4 +2018,12 @@ public void testLowCardinalityValues() throws Exception {
20182018 Assert .assertEquals (record .getString ("keyword" ), values [rowId ]);
20192019 }
20202020 }
2021+
2022+ @ Test (groups = {"integration" })
2023+ public void testGettingRowsBeforeLimit () throws Exception {
2024+ try (QueryResponse response = client .query ("SELECT number FROM system.numbers LIMIT 100" ).get ()) {
2025+ Assert .assertTrue (response .getResultRows () < 1000 );
2026+ Assert .assertEquals (response .getTotalRowsToRead (), 100 );
2027+ }
2028+ }
20212029}
You can’t perform that action at this time.
0 commit comments