Skip to content

Commit 562656d

Browse files
committed
fixes timestamp parameter query print
1 parent 1e4dced commit 562656d

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

google-cloud-examples/src/main/java/com/google/cloud/examples/bigquery/snippets/BigQuerySnippets.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -950,15 +950,13 @@ public void runQueryWithTimestampParameters() throws InterruptedException {
950950
// Print the results.
951951
DateTimeFormatter formatter = ISODateTimeFormat.dateTimeNoMillis().withZoneUTC();
952952
for (FieldValueList row : bigquery.query(queryConfig).iterateAll()) {
953-
for (FieldValue val : row) {
954-
System.out.printf(
955-
"%s\n",
956-
formatter.print(
957-
new DateTime(
958-
// Timestamp values are returned in microseconds since 1970-01-01T00:00:00 UTC,
959-
// but org.joda.time.DateTime constructor accepts times in milliseconds.
960-
row.get(0).getTimestampValue() / 1000, DateTimeZone.UTC)));
961-
}
953+
System.out.printf(
954+
"%s\n",
955+
formatter.print(
956+
new DateTime(
957+
// Timestamp values are returned in microseconds since 1970-01-01T00:00:00 UTC,
958+
// but org.joda.time.DateTime constructor accepts times in milliseconds.
959+
row.get(0).getTimestampValue() / 1000, DateTimeZone.UTC)));
962960
System.out.printf("\n");
963961
}
964962
// [END bigquery_query_params_timestamps]

0 commit comments

Comments
 (0)