Skip to content

Conversation

@olavloite
Copy link
Collaborator

Statements that were executed using the Connection API and that were not found in the statement cache (that is; it was the first time it was executed), would not use the default query options that had been set for the connection. This would mean that for example an optimizer version that had been set for the connection would not be used the first time a given query string would be executed using a connection. All subsequent executions of the statement would use specified optimizer version.

This change ensures that both the first and all following executions of the statement use the default query options that have been set.

Statements that were executed using the Connection API and that were not found in the statement cache (that is; it was the first time it was executed), would not use the default query options that had been set for the connection. This would mean that for example an optimizer version that had been set for the connection would not be used the first time a given query string would be executed using a connection. All subsequent executions of the statement would use specified optimizer version. This change ensures that both the first and all following executions of the statement use the default query options that have been set.
@olavloite olavloite requested a review from a team as a code owner February 6, 2024 13:51
@olavloite olavloite requested a review from ankiaga February 6, 2024 13:51
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: spanner Issues related to the googleapis/java-spanner API. labels Feb 6, 2024

@Test
public void testUseOptimizerVersionFromStatement() {
try (Connection connection = createConnection()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to also pass optimizerVersion here and verify that its overridden?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good point. But this test is not intended to specifically verify that, and we also have specific tests that cover that here:

public void testUseOptimizerVersionAndStatisticsPackageFromEnvironment() {

@olavloite olavloite merged commit 741e4cf into main Feb 8, 2024
@olavloite olavloite deleted the fix-query-options-with-statement-cache branch February 8, 2024 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: spanner Issues related to the googleapis/java-spanner API. size: m Pull request size is medium.

2 participants