Skip to content
Permalink
Browse files
docs: use 'latest' stats package in samples to prevent build failures (
…#1313)

The list of available statistics packages will change over time, meaning that the
samples need to use 'latest' to prevent build failures when a package has been
cleaned up by the backend.

Fixes #1273
  • Loading branch information
olavloite committed Jul 26, 2021
1 parent bafb369 commit 6a8351c9d2cf0fe805b87a611ff1d94d4dba3f87
Showing with 5 additions and 1 deletion.
  1. +5 −1 samples/snippets/src/main/java/com/example/spanner/SpannerSample.java
@@ -1510,7 +1510,9 @@ static void clientWithQueryOptions(DatabaseId db) {
db, QueryOptions
.newBuilder()
.setOptimizerVersion("1")
.setOptimizerStatisticsPackage("auto_20191128_14_47_22UTC")
// The list of available statistics packages can be found by querying the
// "INFORMATION_SCHEMA.SPANNER_STATISTICS" table.
.setOptimizerStatisticsPackage("latest")
.build())
.build();
Spanner spanner = options.getService();
@@ -1538,6 +1540,8 @@ static void queryWithQueryOptions(DatabaseClient dbClient) {
.withQueryOptions(QueryOptions
.newBuilder()
.setOptimizerVersion("1")
// The list of available statistics packages can be found by querying the
// "INFORMATION_SCHEMA.SPANNER_STATISTICS" table.
.setOptimizerStatisticsPackage("latest")
.build())
.build())) {

0 comments on commit 6a8351c

Please sign in to comment.