Skip to content

Commit 6a8351c

Browse files
authored
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
1 parent bafb369 commit 6a8351c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

samples/snippets/src/main/java/com/example/spanner/SpannerSample.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1510,7 +1510,9 @@ static void clientWithQueryOptions(DatabaseId db) {
15101510
db, QueryOptions
15111511
.newBuilder()
15121512
.setOptimizerVersion("1")
1513-
.setOptimizerStatisticsPackage("auto_20191128_14_47_22UTC")
1513+
// The list of available statistics packages can be found by querying the
1514+
// "INFORMATION_SCHEMA.SPANNER_STATISTICS" table.
1515+
.setOptimizerStatisticsPackage("latest")
15141516
.build())
15151517
.build();
15161518
Spanner spanner = options.getService();
@@ -1538,6 +1540,8 @@ static void queryWithQueryOptions(DatabaseClient dbClient) {
15381540
.withQueryOptions(QueryOptions
15391541
.newBuilder()
15401542
.setOptimizerVersion("1")
1543+
// The list of available statistics packages can be found by querying the
1544+
// "INFORMATION_SCHEMA.SPANNER_STATISTICS" table.
15411545
.setOptimizerStatisticsPackage("latest")
15421546
.build())
15431547
.build())) {

0 commit comments

Comments
 (0)