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:
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.
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.
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:
I will do this for 3.6.0.
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.
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.