Druid Avatica JDBC driver does not honor Statement.setMaxRows()
Description
The Druid JDBC driver does not appear to honor the JDBC Statement.setMaxRows(int) setting.
According to the JDBC API, setMaxRows() specifies the maximum number of rows that a Statement should return. However, when using the Druid Avatica JDBC driver, setting maxRows does not limit the number of rows returned in the ResultSet.
Steps to reproduce
- Connect to Druid using the Avatica JDBC driver.
- Create a
PreparedStatement.
- Set
setMaxRows(5).
- Execute a query that returns more than 5 rows.
- Iterate over the
ResultSet.
Sample Code Snippet
try (Connection connection = dataSource.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(sqlQuery)) {
preparedStatement.setMaxRows(maxRecordsToReturn);
try (ResultSet resultSet = preparedStatement.executeQuery()) {
//......
}
}
Version Used
<dependency>
<groupId>org.apache.calcite.avatica</groupId>
<artifactId>avatica-core</artifactId>
<version>1.28.0</version>
</dependency>
Druid Avatica JDBC driver does not honor
Statement.setMaxRows()Description
The Druid JDBC driver does not appear to honor the JDBC
Statement.setMaxRows(int)setting.According to the JDBC API,
setMaxRows()specifies the maximum number of rows that aStatementshould return. However, when using the Druid Avatica JDBC driver, settingmaxRowsdoes not limit the number of rows returned in theResultSet.Steps to reproduce
PreparedStatement.setMaxRows(5).ResultSet.Sample Code Snippet
Version Used