Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

Commit 8ce6df5

Browse files
committed
chore: Rename helper method to validateTimestamp
1 parent 0ba9b8d commit 8ce6df5

2 files changed

Lines changed: 14 additions & 15 deletions

File tree

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/QueryParameterValue.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ private static <T> String valueToStringOrNull(T value, StandardSQLTypeName type)
506506
// Timestamp passed as a String can support up picosecond precision, however,
507507
// DateTimeFormatter only supports nanosecond precision. Higher than nanosecond
508508
// requires a custom validator.
509-
checkValidTimestamp((String) value);
509+
validateTimestamp((String) value);
510510
return (String) value;
511511
}
512512
break;
@@ -549,7 +549,7 @@ private static <T> String valueToStringOrNull(T value, StandardSQLTypeName type)
549549
* @throws IllegalArgumentException if timestamp is invalid or exceeds picosecond precision
550550
*/
551551
@VisibleForTesting
552-
static void checkValidTimestamp(String timestamp) {
552+
static void validateTimestamp(String timestamp) {
553553
// Match if there is greater than nanosecond precision (>9 fractional digits)
554554
Matcher matcher = ISO8601_TIMESTAMP_HIGH_PRECISION_PATTERN.matcher(timestamp);
555555
if (matcher.find()) {

google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/QueryParameterValueTest.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -324,19 +324,18 @@ public void testTimestampWithFormatter() {
324324

325325
@Test
326326
public void testTimestampFromString() {
327-
// QueryParameterValue value = QueryParameterValue.timestamp("2014-08-19
328-
// 12:41:35.220000+00:00");
329-
// assertThat(value.getValue()).isEqualTo("2014-08-19 12:41:35.220000+00:00");
330-
// assertThat(value.getType()).isEqualTo(StandardSQLTypeName.TIMESTAMP);
331-
// assertThat(value.getArrayType()).isNull();
332-
// assertThat(value.getArrayValues()).isNull();
333-
//
334-
// QueryParameterValue value1 =
335-
// QueryParameterValue.timestamp("2025-08-19 12:34:56.123456789+00:00");
336-
// assertThat(value1.getValue()).isEqualTo("2025-08-19 12:34:56.123456789+00:00");
337-
// assertThat(value1.getType()).isEqualTo(StandardSQLTypeName.TIMESTAMP);
338-
// assertThat(value1.getArrayType()).isNull();
339-
// assertThat(value1.getArrayValues()).isNull();
327+
QueryParameterValue value = QueryParameterValue.timestamp("2014-08-19 12:41:35.220000+00:00");
328+
assertThat(value.getValue()).isEqualTo("2014-08-19 12:41:35.220000+00:00");
329+
assertThat(value.getType()).isEqualTo(StandardSQLTypeName.TIMESTAMP);
330+
assertThat(value.getArrayType()).isNull();
331+
assertThat(value.getArrayValues()).isNull();
332+
333+
QueryParameterValue value1 =
334+
QueryParameterValue.timestamp("2025-08-19 12:34:56.123456789+00:00");
335+
assertThat(value1.getValue()).isEqualTo("2025-08-19 12:34:56.123456789+00:00");
336+
assertThat(value1.getType()).isEqualTo(StandardSQLTypeName.TIMESTAMP);
337+
assertThat(value1.getArrayType()).isNull();
338+
assertThat(value1.getArrayValues()).isNull();
340339

341340
// The following test cases test more than nanosecond precision
342341
// 10 digits of precision (1 digit more than nanosecond)

0 commit comments

Comments
 (0)