@@ -633,6 +633,7 @@ public int hashCode() {
633633 *
634634 * <p>Example of listing datasets, specifying the page size.
635635 * <pre> {@code
636+ * // List datasets in the default project
636637 * Page<Dataset> datasets = bigquery.listDatasets(DatasetListOption.pageSize(100));
637638 * for (Dataset dataset : datasets.iterateAll()) {
638639 * // do something with the dataset
@@ -653,6 +654,7 @@ public int hashCode() {
653654 * <p>Example of listing datasets in a project, specifying the page size.
654655 * <pre> {@code
655656 * String projectId = "my_project_id";
657+ * // List datasets in a specified project
656658 * Page<Dataset> datasets = bigquery.listDatasets(projectId, DatasetListOption.pageSize(100));
657659 * for (Dataset dataset : datasets.iterateAll()) {
658660 * // do something with the dataset
@@ -748,12 +750,12 @@ public int hashCode() {
748750 /**
749751 * Updates dataset information.
750752 *
751- * <p>Example of updating a dataset by changing its friendly name .
753+ * <p>Example of updating a dataset by changing its description .
752754 * <pre> {@code
753755 * String datasetName = "my_dataset_name";
754- * String newFriendlyName = "some_new_friendly_name ";
756+ * String newDescription = "some_new_description ";
755757 * Dataset oldDataset = bigquery.getDataset(datasetName);
756- * DatasetInfo datasetInfo = oldDataset.toBuilder().setFriendlyName(newFriendlyName ).build();
758+ * DatasetInfo datasetInfo = oldDataset.toBuilder().setDescription(newDescription ).build();
757759 * Dataset newDataset = bigquery.update(datasetInfo);
758760 * }</pre>
759761 *
@@ -764,13 +766,13 @@ public int hashCode() {
764766 /**
765767 * Updates table information.
766768 *
767- * <p>Example of updating a table by changing its friendly name .
769+ * <p>Example of updating a table by changing its description .
768770 * <pre> {@code
769771 * String datasetName = "my_dataset_name";
770772 * String tableName = "my_table_name";
771- * String newFriendlyName = "new_friendly_name ";
773+ * String newDescription = "new_description ";
772774 * Table oldTable = bigquery.getTable(datasetName, tableName);
773- * TableInfo tableInfo = oldTable.toBuilder().setFriendlyName(newFriendlyName ).build();
775+ * TableInfo tableInfo = oldTable.toBuilder().setDescription(newDescription ).build();
774776 * Table newTable = bigquery.update(tableInfo);
775777 * }</pre>
776778 *
@@ -974,8 +976,7 @@ TableResult listTableData(
974976 * or "EU", {@link #getJob(JobId, JobOption...)} must be used instead.
975977 *
976978 * <p>Example of getting a job.
977- *
978- * <pre>{@code
979+ * <pre> {@code
979980 * String jobName = "my_job_name";
980981 * Job job = bigquery.getJob(jobName);
981982 * if (job == null) {
@@ -992,8 +993,7 @@ TableResult listTableData(
992993 * or "EU", the {@code jobId} must specify the job location.
993994 *
994995 * <p>Example of getting a job.
995- *
996- * <pre>{@code
996+ * <pre> {@code
997997 * String jobName = "my_job_name";
998998 * JobId jobIdObject = JobId.of(jobName);
999999 * Job job = bigquery.getJob(jobIdObject);
@@ -1029,8 +1029,7 @@ TableResult listTableData(
10291029 * <p>If the location of the job is not "US" or "EU", {@link #cancel(JobId)} must be used instead.
10301030 *
10311031 * <p>Example of cancelling a job.
1032- *
1033- * <pre>{@code
1032+ * <pre> {@code
10341033 * String jobName = "my_job_name";
10351034 * boolean success = bigquery.cancel(jobName);
10361035 * if (success) {
@@ -1055,8 +1054,7 @@ TableResult listTableData(
10551054 * location.
10561055 *
10571056 * <p>Example of cancelling a job.
1058- *
1059- * <pre>{@code
1057+ * <pre> {@code
10601058 * String jobName = "my_job_name";
10611059 * JobId jobId = JobId.of(jobName);
10621060 * boolean success = bigquery.cancel(jobId);
@@ -1083,26 +1081,19 @@ TableResult listTableData(
10831081 * queries. Since dry-run queries are not actually executed, there's no way to retrieve results.
10841082 *
10851083 * <p>Example of running a query.
1086- *
1087- * <pre>{@code
1088- * String query = "SELECT unique(corpus) FROM [bigquery-public-data:samples.shakespeare]";
1084+ * <pre> {@code
1085+ * // BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService();
1086+ * String query =
1087+ * "SELECT corpus FROM `bigquery-public-data.samples.shakespeare` GROUP BY corpus;";
10891088 * QueryJobConfiguration queryConfig =
1090- * QueryJobConfiguration.newBuilder(query).setUseLegacySql(true).build();
1089+ * QueryJobConfiguration.newBuilder(query).build();
1090+ *
1091+ * // Print the results.
10911092 * for (FieldValueList row : bigquery.query(queryConfig).iterateAll()) {
1092- * // do something with the data
1093- * }
1094- * }</pre>
1095- *
1096- * <p>Example of running a query with query parameters.
1097- *
1098- * <pre>{@code
1099- * String query = "SELECT distinct(corpus) FROM `bigquery-public-data.samples.shakespeare` where word_count > @wordCount";
1100- * // Note, standard SQL is required to use query parameters. Legacy SQL will not work.
1101- * QueryJobConfiguration queryConfig = QueryJobConfiguration.newBuilder(query)
1102- * .addNamedParameter("wordCount", QueryParameterValue.int64(5))
1103- * .build();
1104- * for (FieldValueList row : bigquery.query(queryConfig).iterateAll()) {
1105- * // do something with the data
1093+ * for (FieldValue val : row) {
1094+ * System.out.printf("%s,", val.toString());
1095+ * }
1096+ * System.out.printf("\n");
11061097 * }
11071098 * }</pre>
11081099 *
@@ -1148,8 +1139,7 @@ TableResult query(QueryJobConfiguration configuration, JobId jobId, JobOption...
11481139 * not in "US" or "EU", {@link #writer(JobId, WriteChannelConfiguration)} must be used instead.
11491140 *
11501141 * <p>Example of creating a channel with which to write to a table.
1151- *
1152- * <pre>{@code
1142+ * <pre> {@code
11531143 * String datasetName = "my_dataset_name";
11541144 * String tableName = "my_table_name";
11551145 * String csvData = "StringValue1\nStringValue2\n";
@@ -1159,31 +1149,33 @@ TableResult query(QueryJobConfiguration configuration, JobId jobId, JobOption...
11591149 * .setFormatOptions(FormatOptions.csv())
11601150 * .build();
11611151 * TableDataWriteChannel writer = bigquery.writer(writeChannelConfiguration);
1162- * // Write data to writer
1163- * try {
1164- * writer.write(ByteBuffer.wrap(csvData.getBytes(Charsets.UTF_8)));
1165- * } finally {
1166- * writer.close();
1167- * }
1168- * // Get load job
1169- * Job job = writer.getJob();
1170- * job = job.waitFor();
1171- * LoadStatistics stats = job.getStatistics();
1172- * return stats.getOutputRows();
1152+ * // Write data to writer
1153+ * try {
1154+ * writer.write(ByteBuffer.wrap(csvData.getBytes(Charsets.UTF_8)));
1155+ * } finally {
1156+ * writer.close();
1157+ * }
1158+ * // Get load job
1159+ * Job job = writer.getJob();
1160+ * job = job.waitFor();
1161+ * LoadStatistics stats = job.getStatistics();
1162+ * return stats.getOutputRows();
11731163 * }</pre>
11741164 *
11751165 * <p>Example of writing a local file to a table.
1176- *
1177- * <pre>{@code
1166+ * <pre> {@code
11781167 * String datasetName = "my_dataset_name";
11791168 * String tableName = "my_table_name";
11801169 * Path csvPath = FileSystems.getDefault().getPath(".", "my-data.csv");
1170+ * String location = "us";
11811171 * TableId tableId = TableId.of(datasetName, tableName);
11821172 * WriteChannelConfiguration writeChannelConfiguration =
11831173 * WriteChannelConfiguration.newBuilder(tableId)
11841174 * .setFormatOptions(FormatOptions.csv())
11851175 * .build();
1186- * TableDataWriteChannel writer = bigquery.writer(writeChannelConfiguration);
1176+ * // The location must be specified; other fields can be auto-detected.
1177+ * JobId jobId = JobId.newBuilder().setLocation(location).build();
1178+ * TableDataWriteChannel writer = bigquery.writer(jobId, writeChannelConfiguration);
11871179 * // Write data to writer
11881180 * try (OutputStream stream = Channels.newOutputStream(writer)) {
11891181 * Files.copy(csvPath, stream);
@@ -1205,13 +1197,11 @@ TableResult query(QueryJobConfiguration configuration, JobId jobId, JobOption...
12051197 * not in "US" or "EU", the {@code jobId} must contain the location of the job.
12061198 *
12071199 * <p>Example of creating a channel with which to write to a table.
1208- *
1209- * <pre>{@code
1200+ * <pre> {@code
12101201 * String datasetName = "my_dataset_name";
12111202 * String tableName = "my_table_name";
12121203 * String csvData = "StringValue1\nStringValue2\n";
1213- * String csvData = "StringValue1\nStringValue2\n";
1214- * String location = "asia-northeast1";
1204+ * String location = "us";
12151205 * TableId tableId = TableId.of(datasetName, tableName);
12161206 * WriteChannelConfiguration writeChannelConfiguration =
12171207 * WriteChannelConfiguration.newBuilder(tableId).setFormatOptions(FormatOptions.csv()).build();
@@ -1230,6 +1220,7 @@ TableResult query(QueryJobConfiguration configuration, JobId jobId, JobOption...
12301220 * LoadStatistics stats = job.getStatistics();
12311221 * return stats.getOutputRows();
12321222 * }</pre>
1223+ *
12331224 */
12341225 TableDataWriteChannel writer (JobId jobId , WriteChannelConfiguration writeChannelConfiguration );
12351226}
0 commit comments