Session.prepareAsync(RegularStatement) ignores fetch size

Description

Session.prepareAsync(RegularStatement)'s javadoc states that "the resulting PreparedStatement will inherit the query properties set on statement". However, this is not the case for fetch size. For some reason, PreparedStatement doesn't have it (why?), but BoundStatement produced from it does, and it doesn't inherit fetch size from the original RegularStatement.

Sketch of a test case:

Environment

None

Pull Requests

None

Activity

Show:
Kevin Gallardo
May 7, 2018, 3:31 PM

I think it is just an oversight, but we need to make sure we want to apply this to all options before doing it. Also we want to make it consistent over the other language drivers.

Andy Tolbert
August 8, 2018, 4:05 PM

What I am wondering is if we should apply that to all other options available on Statement, such as readTimeoutMillis, timestamp, retry Policy, paging state, and so on.

We just discussed this privately and agreed that in the context of this ticket we should evaluate all options that are candidates for being propagated in the context of this ticket.

Andy Tolbert
August 14, 2018, 10:42 PM

Unfortunately because PreparedStatement is an interface we can't add the associated setXXX methods (i.e. setFetchSize) without a breaking API change, so we can't do this in 3.6.0. This would be possible with Java 8 and default interface methods, but since we want to maintain JDK 6 and 7 support we cannot use those.

In Java Driver 4, we have already made sure that everything propagates from Statement -> PreparedStatement. I think at the very least we should document which configuration does not propagate for 3.x though. I think these are:

  • setFetchSize

  • setDefaultTimestamp()

  • setPagingState()

  • setRequestTimeoutMillis()

I will do this for 3.6.0.

Kevin Gallardo
August 16, 2018, 2:48 PM

I believe the topic of the ticket here gravitated towards can the options on a SimpleStatement be propagated to the BoundStatement? With the PreparedStatement in the middle yes, but even though the options aren't available on the PreparedStatement, shouldn't they be propagated from SimpleStatement to BoundStatement if set on the SimpleStatement? Currently iirc this is not the case for fetchSize and others.

Andy Tolbert
August 16, 2018, 2:50 PM
Edited

shouldn't they be propagated from SimpleStatement to BoundStatement if set on the SimpleStatement?

It would be preferable, but it don't believe it can be done without a breaking API change.

Fixed

Assignee

Andy Tolbert

Reporter

Igor Baltiyskiy

Labels

None

PM Priority

None

Reproduced in

None

Affects versions

Fix versions

Pull Request

None

Doc Impact

None

Size

None

External issue ID

None

External issue ID

None

Components

Priority

Major
Configure