From af7f5048390deb9cccb30bd4b90643f5c77db3ab Mon Sep 17 00:00:00 2001 From: Kirill Logachev Date: Tue, 2 Jun 2026 01:47:55 +0000 Subject: [PATCH] fix(bigquery): update internal Field.mode type to enum instead of string --- .../src/main/java/com/google/cloud/bigquery/Field.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Field.java b/java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Field.java index 88e09c5c4817..e1e37a1d5a10 100644 --- a/java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Field.java +++ b/java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Field.java @@ -57,7 +57,7 @@ public TableFieldSchema apply(Field field) { private final String name; private final LegacySQLTypeName type; private final FieldList subFields; - private final String mode; + private final Mode mode; private final String description; private final PolicyTags policyTags; private final Long maxLength; @@ -84,7 +84,7 @@ public static final class Builder { private String name; private LegacySQLTypeName type; private FieldList subFields; - private String mode; + private Mode mode; private String description; private PolicyTags policyTags; private Long maxLength; @@ -205,7 +205,7 @@ public Builder setType(StandardSQLTypeName type, FieldList subFields) { /** Sets the mode of the field. When not specified {@link Mode#NULLABLE} is used. */ public Builder setMode(Mode mode) { - this.mode = mode != null ? mode.name() : null; + this.mode = mode; return this; } @@ -357,7 +357,7 @@ public LegacySQLTypeName getType() { /** Returns the field mode. By default {@link Mode#NULLABLE} is used. */ public Mode getMode() { - return mode != null ? Mode.valueOf(mode) : null; + return mode; } /** Returns the field description. */ @@ -509,7 +509,7 @@ TableFieldSchema toPb() { fieldSchemaPb.setName(name); fieldSchemaPb.setType(type.name()); if (mode != null) { - fieldSchemaPb.setMode(mode); + fieldSchemaPb.setMode(mode.name()); } if (description != null) { fieldSchemaPb.setDescription(description);