From 0df1893532e460115743646c28e3b5843dbafae8 Mon Sep 17 00:00:00 2001 From: Neenu1995 Date: Thu, 13 Oct 2022 18:44:16 -0400 Subject: [PATCH 1/9] feat: add getReadableTimestampValue() method to FieldValue --- .../com/google/cloud/bigquery/FieldValue.java | 19 +++++++++++++++++++ .../cloud/bigquery/it/ITBigQueryTest.java | 17 +++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java index aef4728194..ced9cf6c55 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java @@ -29,6 +29,8 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import org.threeten.bp.Instant; +import org.threeten.bp.temporal.ChronoUnit; /** * Google BigQuery Table Field Value class. Objects of this class represent values of a BigQuery @@ -191,6 +193,23 @@ public long getTimestampValue() { return scaled.longValue(); } + /** + * Returns this field's value as a {@code String}, representing a timestamp as a readable string. + * This method should only be used if the corresponding field has {@link + * LegacySQLTypeName#TIMESTAMP} type. + * + * @throws ClassCastException if the field is not a primitive type + * @throws NumberFormatException if the field's value could not be converted to {@link Long} + * @throws NullPointerException if {@link #isNull()} returns {@code true} + * @return + */ + @SuppressWarnings("unchecked") + public String getReadableTimestampValue() { + checkNotNull(value); + Instant instant = Instant.EPOCH.plus(getTimestampValue(), ChronoUnit.MICROS); + return instant.toString(); + } + /** * Returns this field's value as a {@link java.math.BigDecimal}. This method should only be used * if the corresponding field has {@link LegacySQLTypeName#NUMERIC} type. diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java index 8e8f4cc0c5..eedf1d7f45 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java @@ -2382,6 +2382,23 @@ public void testMultipleStatementsQueryException() throws InterruptedException { } } + @Test + public void testTimestamp() throws InterruptedException { + String query = "SELECT TIMESTAMP '2022-01-24T23:54:25.095574Z'"; + String timestampStringValueExpected = "2022-01-24T23:54:25.095574Z"; + + TableResult resultInteractive = + bigquery.query( + QueryJobConfiguration.newBuilder(query) + .setDefaultDataset(DatasetId.of(DATASET)) + .build()); + for (FieldValueList row : resultInteractive.getValues()) { + FieldValue timeStampCell = row.get(0); + String timestampStringValueActual = timeStampCell.getReadableTimestampValue(); + assertEquals(timestampStringValueExpected, timestampStringValueActual); + } + } + /* TODO(prasmish): replicate the entire test case for executeSelect */ @Test public void testQuery() throws InterruptedException { From a932743f24616c8fc2ede9e7d3370ed2d079294a Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 13 Oct 2022 22:47:22 +0000 Subject: [PATCH 2/9] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .../src/main/java/com/google/cloud/bigquery/FieldValue.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java index ced9cf6c55..1fb12447d8 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java @@ -206,8 +206,8 @@ public long getTimestampValue() { @SuppressWarnings("unchecked") public String getReadableTimestampValue() { checkNotNull(value); - Instant instant = Instant.EPOCH.plus(getTimestampValue(), ChronoUnit.MICROS); - return instant.toString(); + Instant instant = Instant.EPOCH.plus(getTimestampValue(), ChronoUnit.MICROS); + return instant.toString(); } /** From 368386e1f36e34a5562a52ae80d0e958d0c8331a Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 13 Oct 2022 22:47:54 +0000 Subject: [PATCH 3/9] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .../src/main/java/com/google/cloud/bigquery/FieldValue.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java index ced9cf6c55..1fb12447d8 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java @@ -206,8 +206,8 @@ public long getTimestampValue() { @SuppressWarnings("unchecked") public String getReadableTimestampValue() { checkNotNull(value); - Instant instant = Instant.EPOCH.plus(getTimestampValue(), ChronoUnit.MICROS); - return instant.toString(); + Instant instant = Instant.EPOCH.plus(getTimestampValue(), ChronoUnit.MICROS); + return instant.toString(); } /** From 226dc174143c7b098343670aa9dc55b67b7b5bef Mon Sep 17 00:00:00 2001 From: Neenu1995 Date: Fri, 28 Oct 2022 12:58:55 -0400 Subject: [PATCH 4/9] chore: return java.time.Instant --- .../com/google/cloud/bigquery/FieldValue.java | 43 +++++++++++-------- .../cloud/bigquery/it/ITBigQueryTest.java | 4 +- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java index 1fb12447d8..d3908b6e0b 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java @@ -18,6 +18,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; +import static java.time.temporal.ChronoUnit.MICROS; import com.google.api.client.util.Data; import com.google.api.core.BetaApi; @@ -26,11 +27,10 @@ import java.io.Serializable; import java.math.BigDecimal; import java.math.RoundingMode; +import java.time.Instant; import java.util.List; import java.util.Map; import java.util.Objects; -import org.threeten.bp.Instant; -import org.threeten.bp.temporal.ChronoUnit; /** * Google BigQuery Table Field Value class. Objects of this class represent values of a BigQuery @@ -38,13 +38,16 @@ * query or when listing table data. */ public class FieldValue implements Serializable { + private static final int MICROSECONDS = 1000000; private static final long serialVersionUID = 469098630191710061L; private final Attribute attribute; private final Object value; - /** The field value's attribute, giving information on the field's content type. */ + /** + * The field value's attribute, giving information on the field's content type. + */ public enum Attribute { /** * A primitive field value. A {@code FieldValue} is primitive when the corresponding field has @@ -56,10 +59,14 @@ public enum Attribute { */ PRIMITIVE, - /** A {@code FieldValue} for a field with {@link Field.Mode#REPEATED} mode. */ + /** + * A {@code FieldValue} for a field with {@link Field.Mode#REPEATED} mode. + */ REPEATED, - /** A {@code FieldValue} for a field of type {@link LegacySQLTypeName#RECORD}. */ + /** + * A {@code FieldValue} for a field of type {@link LegacySQLTypeName#RECORD}. + */ RECORD } @@ -72,19 +79,21 @@ private FieldValue(Attribute attribute, Object value) { * Returns the attribute of this Field Value. * * @return {@link Attribute#PRIMITIVE} if the field is a primitive type ({@link - * LegacySQLTypeName#BYTES}, {@link LegacySQLTypeName#BOOLEAN}, {@link - * LegacySQLTypeName#STRING}, {@link LegacySQLTypeName#FLOAT}, {@link - * LegacySQLTypeName#INTEGER}, {@link LegacySQLTypeName#NUMERIC}, {@link - * LegacySQLTypeName#TIMESTAMP}, {@link LegacySQLTypeName#GEOGRAPHY}) or is {@code null}. - *

Returns {@link Attribute#REPEATED} if the corresponding field has ({@link - * Field.Mode#REPEATED}) mode. Returns {@link Attribute#RECORD} if the corresponding field is - * a {@link LegacySQLTypeName#RECORD} type. + * LegacySQLTypeName#BYTES}, {@link LegacySQLTypeName#BOOLEAN}, {@link LegacySQLTypeName#STRING}, + * {@link LegacySQLTypeName#FLOAT}, {@link LegacySQLTypeName#INTEGER}, {@link + * LegacySQLTypeName#NUMERIC}, {@link LegacySQLTypeName#TIMESTAMP}, {@link + * LegacySQLTypeName#GEOGRAPHY}) or is {@code null}. + *

Returns {@link Attribute#REPEATED} if the corresponding field has ({@link + * Field.Mode#REPEATED}) mode. Returns {@link Attribute#RECORD} if the corresponding field is a + * {@link LegacySQLTypeName#RECORD} type. */ public Attribute getAttribute() { return attribute; } - /** Returns {@code true} if this field's value is {@code null}, {@code false} otherwise. */ + /** + * Returns {@code true} if this field's value is {@code null}, {@code false} otherwise. + */ public boolean isNull() { return value == null; } @@ -201,13 +210,11 @@ public long getTimestampValue() { * @throws ClassCastException if the field is not a primitive type * @throws NumberFormatException if the field's value could not be converted to {@link Long} * @throws NullPointerException if {@link #isNull()} returns {@code true} - * @return */ @SuppressWarnings("unchecked") - public String getReadableTimestampValue() { + public Instant getReadableTimestampValue() { checkNotNull(value); - Instant instant = Instant.EPOCH.plus(getTimestampValue(), ChronoUnit.MICROS); - return instant.toString(); + return Instant.EPOCH.plus(getTimestampValue(), MICROS); } /** @@ -216,7 +223,7 @@ public String getReadableTimestampValue() { * * @throws ClassCastException if the field is not a primitive type * @throws NumberFormatException if the field's value could not be converted to {@link - * java.math.BigDecimal} + * java.math.BigDecimal} * @throws NullPointerException if {@link #isNull()} returns {@code true} */ @SuppressWarnings("unchecked") diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java index eedf1d7f45..24b5759fc4 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java @@ -2394,8 +2394,8 @@ public void testTimestamp() throws InterruptedException { .build()); for (FieldValueList row : resultInteractive.getValues()) { FieldValue timeStampCell = row.get(0); - String timestampStringValueActual = timeStampCell.getReadableTimestampValue(); - assertEquals(timestampStringValueExpected, timestampStringValueActual); + Instant timestampStringValueActual = timeStampCell.getReadableTimestampValue(); + assertEquals(timestampStringValueExpected, timestampStringValueActual.toString()); } } From 91e0f4f3c1a998169e9d809fbf166a48a00ecede Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 28 Oct 2022 17:01:28 +0000 Subject: [PATCH 5/9] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- README.md | 4 +-- .../com/google/cloud/bigquery/FieldValue.java | 32 +++++++------------ 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 5d4d46fe72..096c6d9b7c 100644 --- a/README.md +++ b/README.md @@ -59,13 +59,13 @@ implementation 'com.google.cloud:google-cloud-bigquery' If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-bigquery:2.17.1' +implementation 'com.google.cloud:google-cloud-bigquery:2.18.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.17.1" +libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.18.0" ``` ## Authentication diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java index d3908b6e0b..1432b9a88c 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java @@ -45,9 +45,7 @@ public class FieldValue implements Serializable { private final Attribute attribute; private final Object value; - /** - * The field value's attribute, giving information on the field's content type. - */ + /** The field value's attribute, giving information on the field's content type. */ public enum Attribute { /** * A primitive field value. A {@code FieldValue} is primitive when the corresponding field has @@ -59,14 +57,10 @@ public enum Attribute { */ PRIMITIVE, - /** - * A {@code FieldValue} for a field with {@link Field.Mode#REPEATED} mode. - */ + /** A {@code FieldValue} for a field with {@link Field.Mode#REPEATED} mode. */ REPEATED, - /** - * A {@code FieldValue} for a field of type {@link LegacySQLTypeName#RECORD}. - */ + /** A {@code FieldValue} for a field of type {@link LegacySQLTypeName#RECORD}. */ RECORD } @@ -79,21 +73,19 @@ private FieldValue(Attribute attribute, Object value) { * Returns the attribute of this Field Value. * * @return {@link Attribute#PRIMITIVE} if the field is a primitive type ({@link - * LegacySQLTypeName#BYTES}, {@link LegacySQLTypeName#BOOLEAN}, {@link LegacySQLTypeName#STRING}, - * {@link LegacySQLTypeName#FLOAT}, {@link LegacySQLTypeName#INTEGER}, {@link - * LegacySQLTypeName#NUMERIC}, {@link LegacySQLTypeName#TIMESTAMP}, {@link - * LegacySQLTypeName#GEOGRAPHY}) or is {@code null}. - *

Returns {@link Attribute#REPEATED} if the corresponding field has ({@link - * Field.Mode#REPEATED}) mode. Returns {@link Attribute#RECORD} if the corresponding field is a - * {@link LegacySQLTypeName#RECORD} type. + * LegacySQLTypeName#BYTES}, {@link LegacySQLTypeName#BOOLEAN}, {@link + * LegacySQLTypeName#STRING}, {@link LegacySQLTypeName#FLOAT}, {@link + * LegacySQLTypeName#INTEGER}, {@link LegacySQLTypeName#NUMERIC}, {@link + * LegacySQLTypeName#TIMESTAMP}, {@link LegacySQLTypeName#GEOGRAPHY}) or is {@code null}. + *

Returns {@link Attribute#REPEATED} if the corresponding field has ({@link + * Field.Mode#REPEATED}) mode. Returns {@link Attribute#RECORD} if the corresponding field is + * a {@link LegacySQLTypeName#RECORD} type. */ public Attribute getAttribute() { return attribute; } - /** - * Returns {@code true} if this field's value is {@code null}, {@code false} otherwise. - */ + /** Returns {@code true} if this field's value is {@code null}, {@code false} otherwise. */ public boolean isNull() { return value == null; } @@ -223,7 +215,7 @@ public Instant getReadableTimestampValue() { * * @throws ClassCastException if the field is not a primitive type * @throws NumberFormatException if the field's value could not be converted to {@link - * java.math.BigDecimal} + * java.math.BigDecimal} * @throws NullPointerException if {@link #isNull()} returns {@code true} */ @SuppressWarnings("unchecked") From 17efa84ee07566204df3ac35cd0d39d4c9ca1d3c Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 28 Oct 2022 17:03:17 +0000 Subject: [PATCH 6/9] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- README.md | 4 +-- .../com/google/cloud/bigquery/FieldValue.java | 32 +++++++------------ 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 5d4d46fe72..096c6d9b7c 100644 --- a/README.md +++ b/README.md @@ -59,13 +59,13 @@ implementation 'com.google.cloud:google-cloud-bigquery' If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-bigquery:2.17.1' +implementation 'com.google.cloud:google-cloud-bigquery:2.18.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.17.1" +libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.18.0" ``` ## Authentication diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java index d3908b6e0b..1432b9a88c 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java @@ -45,9 +45,7 @@ public class FieldValue implements Serializable { private final Attribute attribute; private final Object value; - /** - * The field value's attribute, giving information on the field's content type. - */ + /** The field value's attribute, giving information on the field's content type. */ public enum Attribute { /** * A primitive field value. A {@code FieldValue} is primitive when the corresponding field has @@ -59,14 +57,10 @@ public enum Attribute { */ PRIMITIVE, - /** - * A {@code FieldValue} for a field with {@link Field.Mode#REPEATED} mode. - */ + /** A {@code FieldValue} for a field with {@link Field.Mode#REPEATED} mode. */ REPEATED, - /** - * A {@code FieldValue} for a field of type {@link LegacySQLTypeName#RECORD}. - */ + /** A {@code FieldValue} for a field of type {@link LegacySQLTypeName#RECORD}. */ RECORD } @@ -79,21 +73,19 @@ private FieldValue(Attribute attribute, Object value) { * Returns the attribute of this Field Value. * * @return {@link Attribute#PRIMITIVE} if the field is a primitive type ({@link - * LegacySQLTypeName#BYTES}, {@link LegacySQLTypeName#BOOLEAN}, {@link LegacySQLTypeName#STRING}, - * {@link LegacySQLTypeName#FLOAT}, {@link LegacySQLTypeName#INTEGER}, {@link - * LegacySQLTypeName#NUMERIC}, {@link LegacySQLTypeName#TIMESTAMP}, {@link - * LegacySQLTypeName#GEOGRAPHY}) or is {@code null}. - *

Returns {@link Attribute#REPEATED} if the corresponding field has ({@link - * Field.Mode#REPEATED}) mode. Returns {@link Attribute#RECORD} if the corresponding field is a - * {@link LegacySQLTypeName#RECORD} type. + * LegacySQLTypeName#BYTES}, {@link LegacySQLTypeName#BOOLEAN}, {@link + * LegacySQLTypeName#STRING}, {@link LegacySQLTypeName#FLOAT}, {@link + * LegacySQLTypeName#INTEGER}, {@link LegacySQLTypeName#NUMERIC}, {@link + * LegacySQLTypeName#TIMESTAMP}, {@link LegacySQLTypeName#GEOGRAPHY}) or is {@code null}. + *

Returns {@link Attribute#REPEATED} if the corresponding field has ({@link + * Field.Mode#REPEATED}) mode. Returns {@link Attribute#RECORD} if the corresponding field is + * a {@link LegacySQLTypeName#RECORD} type. */ public Attribute getAttribute() { return attribute; } - /** - * Returns {@code true} if this field's value is {@code null}, {@code false} otherwise. - */ + /** Returns {@code true} if this field's value is {@code null}, {@code false} otherwise. */ public boolean isNull() { return value == null; } @@ -223,7 +215,7 @@ public Instant getReadableTimestampValue() { * * @throws ClassCastException if the field is not a primitive type * @throws NumberFormatException if the field's value could not be converted to {@link - * java.math.BigDecimal} + * java.math.BigDecimal} * @throws NullPointerException if {@link #isNull()} returns {@code true} */ @SuppressWarnings("unchecked") From 79cfd99b4ab2a31253b28d05ca687f5a2af3c93f Mon Sep 17 00:00:00 2001 From: Neenu1995 Date: Thu, 3 Nov 2022 11:55:48 -0400 Subject: [PATCH 7/9] chore: change method name --- .../src/main/java/com/google/cloud/bigquery/FieldValue.java | 2 +- .../test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java index 1432b9a88c..2259245357 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java @@ -204,7 +204,7 @@ public long getTimestampValue() { * @throws NullPointerException if {@link #isNull()} returns {@code true} */ @SuppressWarnings("unchecked") - public Instant getReadableTimestampValue() { + public Instant getTimestampInstant() { checkNotNull(value); return Instant.EPOCH.plus(getTimestampValue(), MICROS); } diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java index 24b5759fc4..4f72e7e66d 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java @@ -2394,7 +2394,7 @@ public void testTimestamp() throws InterruptedException { .build()); for (FieldValueList row : resultInteractive.getValues()) { FieldValue timeStampCell = row.get(0); - Instant timestampStringValueActual = timeStampCell.getReadableTimestampValue(); + Instant timestampStringValueActual = timeStampCell.getTimestampInstant(); assertEquals(timestampStringValueExpected, timestampStringValueActual.toString()); } } From 9021bb22b3d0e6b6959d3cdb9b9b57c74d7c25b1 Mon Sep 17 00:00:00 2001 From: Neenu Shaji Date: Thu, 3 Nov 2022 14:03:59 -0400 Subject: [PATCH 8/9] Update FieldValue.java --- .../src/main/java/com/google/cloud/bigquery/FieldValue.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java index 2259245357..f6daa971f6 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java @@ -195,7 +195,7 @@ public long getTimestampValue() { } /** - * Returns this field's value as a {@code String}, representing a timestamp as a readable string. + * Returns this field's value as a {@code String}, representing a timestamp as an Instant. * This method should only be used if the corresponding field has {@link * LegacySQLTypeName#TIMESTAMP} type. * From 58504a1afb2fbbf0aba1fc04e6fe37db24e4f5d9 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 3 Nov 2022 18:06:17 +0000 Subject: [PATCH 9/9] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .../src/main/java/com/google/cloud/bigquery/FieldValue.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java index f6daa971f6..58c012a60e 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java @@ -195,9 +195,9 @@ public long getTimestampValue() { } /** - * Returns this field's value as a {@code String}, representing a timestamp as an Instant. - * This method should only be used if the corresponding field has {@link - * LegacySQLTypeName#TIMESTAMP} type. + * Returns this field's value as a {@code String}, representing a timestamp as an Instant. This + * method should only be used if the corresponding field has {@link LegacySQLTypeName#TIMESTAMP} + * type. * * @throws ClassCastException if the field is not a primitive type * @throws NumberFormatException if the field's value could not be converted to {@link Long}