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

Commit 2676f1c

Browse files
committed
chore: Address GCA PR feedback
1 parent 2d5ae76 commit 2676f1c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

  • google-cloud-bigquery/src/main/java/com/google/cloud/bigquery

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.google.api.services.bigquery.model.TableFieldSchema;
2626
import com.google.common.base.Function;
2727
import com.google.common.base.MoreObjects;
28+
import com.google.common.base.Preconditions;
2829
import com.google.common.collect.Lists;
2930
import java.io.Serializable;
3031
import java.util.List;
@@ -89,7 +90,7 @@ public static final class Builder {
8990
private Long maxLength;
9091
private Long scale;
9192
private Long precision;
92-
private Long timestampPrecision;
93+
private Long timestampPrecision = 6L; // Default to microsecond precision
9394
private String defaultValueExpression;
9495
private String collation;
9596
private FieldElementType rangeElementType;
@@ -263,6 +264,9 @@ public Builder setPrecision(Long precision) {
263264
* <p>The default value is 6. Possible values are 6 (microsecond) or 12 (picosecond).
264265
*/
265266
public Builder setTimestampPrecision(Long timestampPrecision) {
267+
Preconditions.checkArgument(
268+
timestampPrecision == 6L || timestampPrecision == 12L,
269+
"Timestamp Precision must be 6 (microsecond) or 12 (picosecond)");
266270
this.timestampPrecision = timestampPrecision;
267271
return this;
268272
}
@@ -384,7 +388,7 @@ public Long getPrecision() {
384388
return precision;
385389
}
386390

387-
/** Returns the for precision of TIMESTAMP type. */
391+
/** Returns the precision for TIMESTAMP type. */
388392
public Long getTimestampPrecision() {
389393
return timestampPrecision;
390394
}

0 commit comments

Comments
 (0)