Skip to content

Druid Avatica JDBC driver does not honor Statement.setMaxRows() #19918

Description

@harikrishna553

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

  1. Connect to Druid using the Avatica JDBC driver.
  2. Create a PreparedStatement.
  3. Set setMaxRows(5).
  4. Execute a query that returns more than 5 rows.
  5. 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>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions