Skip to content

Commit

Permalink
added total_rows_to_read to metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
chernser committed Jan 23, 2025
1 parent 64aa9df commit 7e4f171
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,15 @@ public long getResultRows() {
return operationMetrics.getMetric(ServerMetrics.RESULT_ROWS).getLong();
}


/**
* Alias for {@link ServerMetrics#TOTAL_ROWS_TO_READ}
* @return estimated number of rows to read
*/
public long getTotalRowsToRead() {
return operationMetrics.getMetric(ServerMetrics.TOTAL_ROWS_TO_READ).getLong();
}

/**
* Alias for {@link OperationMetrics#getQueryId()}
* @return query id of the request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2018,4 +2018,12 @@ public void testLowCardinalityValues() throws Exception {
Assert.assertEquals(record.getString("keyword"), values[rowId]);
}
}

@Test(groups = {"integration"})
public void testGettingRowsBeforeLimit() throws Exception {
try (QueryResponse response = client.query("SELECT number FROM system.numbers LIMIT 100").get()) {
Assert.assertTrue(response.getResultRows() < 1000);
Assert.assertEquals(response.getTotalRowsToRead(), 100);
}
}
}

0 comments on commit 7e4f171

Please sign in to comment.