From 89c767f059ead3ce30842a478e395ac657f4b4ef Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 21 Feb 2023 12:15:13 -0500 Subject: [PATCH] feat: add default_value_expression to TableFieldSchema (#1988) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add default_value_expression to TableFieldSchema PiperOrigin-RevId: 508443364 Source-Link: https://github.com/googleapis/googleapis/commit/fc7d513461f555d3de13d7a777b2f998cf8f5532 Source-Link: https://github.com/googleapis/googleapis-gen/commit/6d4bae6a1c630c31c45b0a6d1c50d69b5dc87881 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmQ0YmFlNmExYzYzMGMzMWM0NWIwYTZkMWM1MGQ2OWI1ZGM4Nzg4MSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot Co-authored-by: Yiru Tang --- .../bigquery/storage/v1/TableFieldSchema.java | 189 ++++++++++++++++++ .../storage/v1/TableFieldSchemaOrBuilder.java | 27 +++ .../cloud/bigquery/storage/v1/TableProto.java | 40 ++-- .../cloud/bigquery/storage/v1/table.proto | 4 + 4 files changed, 244 insertions(+), 16 deletions(-) diff --git a/proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/TableFieldSchema.java b/proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/TableFieldSchema.java index 717717bb91..ce3a4143f4 100644 --- a/proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/TableFieldSchema.java +++ b/proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/TableFieldSchema.java @@ -43,6 +43,7 @@ private TableFieldSchema() { mode_ = 0; fields_ = java.util.Collections.emptyList(); description_ = ""; + defaultValueExpression_ = ""; } @java.lang.Override @@ -991,6 +992,59 @@ public long getScale() { return scale_; } + public static final int DEFAULT_VALUE_EXPRESSION_FIELD_NUMBER = 10; + + @SuppressWarnings("serial") + private volatile java.lang.Object defaultValueExpression_ = ""; + /** + * + * + *
+   * Optional. A SQL expression to specify the [default value]
+   * (https://cloud.google.com/bigquery/docs/default-values) for this field.
+   * 
+ * + * string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The defaultValueExpression. + */ + @java.lang.Override + public java.lang.String getDefaultValueExpression() { + java.lang.Object ref = defaultValueExpression_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + defaultValueExpression_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. A SQL expression to specify the [default value]
+   * (https://cloud.google.com/bigquery/docs/default-values) for this field.
+   * 
+ * + * string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for defaultValueExpression. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDefaultValueExpressionBytes() { + java.lang.Object ref = defaultValueExpression_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + defaultValueExpression_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -1033,6 +1087,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (scale_ != 0L) { output.writeInt64(9, scale_); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(defaultValueExpression_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 10, defaultValueExpression_); + } getUnknownFields().writeTo(output); } @@ -1070,6 +1127,9 @@ public int getSerializedSize() { if (scale_ != 0L) { size += com.google.protobuf.CodedOutputStream.computeInt64Size(9, scale_); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(defaultValueExpression_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(10, defaultValueExpression_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -1094,6 +1154,7 @@ public boolean equals(final java.lang.Object obj) { if (getMaxLength() != other.getMaxLength()) return false; if (getPrecision() != other.getPrecision()) return false; if (getScale() != other.getScale()) return false; + if (!getDefaultValueExpression().equals(other.getDefaultValueExpression())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -1123,6 +1184,8 @@ public int hashCode() { hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getPrecision()); hash = (37 * hash) + SCALE_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getScale()); + hash = (37 * hash) + DEFAULT_VALUE_EXPRESSION_FIELD_NUMBER; + hash = (53 * hash) + getDefaultValueExpression().hashCode(); hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -1277,6 +1340,7 @@ public Builder clear() { maxLength_ = 0L; precision_ = 0L; scale_ = 0L; + defaultValueExpression_ = ""; return this; } @@ -1348,6 +1412,9 @@ private void buildPartial0(com.google.cloud.bigquery.storage.v1.TableFieldSchema if (((from_bitField0_ & 0x00000080) != 0)) { result.scale_ = scale_; } + if (((from_bitField0_ & 0x00000100) != 0)) { + result.defaultValueExpression_ = defaultValueExpression_; + } } @java.lang.Override @@ -1448,6 +1515,11 @@ public Builder mergeFrom(com.google.cloud.bigquery.storage.v1.TableFieldSchema o if (other.getScale() != 0L) { setScale(other.getScale()); } + if (!other.getDefaultValueExpression().isEmpty()) { + defaultValueExpression_ = other.defaultValueExpression_; + bitField0_ |= 0x00000100; + onChanged(); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -1530,6 +1602,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000080; break; } // case 72 + case 82: + { + defaultValueExpression_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000100; + break; + } // case 82 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -2633,6 +2711,117 @@ public Builder clearScale() { return this; } + private java.lang.Object defaultValueExpression_ = ""; + /** + * + * + *
+     * Optional. A SQL expression to specify the [default value]
+     * (https://cloud.google.com/bigquery/docs/default-values) for this field.
+     * 
+ * + * string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The defaultValueExpression. + */ + public java.lang.String getDefaultValueExpression() { + java.lang.Object ref = defaultValueExpression_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + defaultValueExpression_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. A SQL expression to specify the [default value]
+     * (https://cloud.google.com/bigquery/docs/default-values) for this field.
+     * 
+ * + * string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for defaultValueExpression. + */ + public com.google.protobuf.ByteString getDefaultValueExpressionBytes() { + java.lang.Object ref = defaultValueExpression_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + defaultValueExpression_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. A SQL expression to specify the [default value]
+     * (https://cloud.google.com/bigquery/docs/default-values) for this field.
+     * 
+ * + * string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The defaultValueExpression to set. + * @return This builder for chaining. + */ + public Builder setDefaultValueExpression(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + defaultValueExpression_ = value; + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A SQL expression to specify the [default value]
+     * (https://cloud.google.com/bigquery/docs/default-values) for this field.
+     * 
+ * + * string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearDefaultValueExpression() { + defaultValueExpression_ = getDefaultInstance().getDefaultValueExpression(); + bitField0_ = (bitField0_ & ~0x00000100); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A SQL expression to specify the [default value]
+     * (https://cloud.google.com/bigquery/docs/default-values) for this field.
+     * 
+ * + * string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for defaultValueExpression to set. + * @return This builder for chaining. + */ + public Builder setDefaultValueExpressionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + defaultValueExpression_ = value; + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/TableFieldSchemaOrBuilder.java b/proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/TableFieldSchemaOrBuilder.java index 9d916b387a..69a51f61a0 100644 --- a/proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/TableFieldSchemaOrBuilder.java +++ b/proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/TableFieldSchemaOrBuilder.java @@ -269,4 +269,31 @@ public interface TableFieldSchemaOrBuilder * @return The scale. */ long getScale(); + + /** + * + * + *
+   * Optional. A SQL expression to specify the [default value]
+   * (https://cloud.google.com/bigquery/docs/default-values) for this field.
+   * 
+ * + * string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The defaultValueExpression. + */ + java.lang.String getDefaultValueExpression(); + /** + * + * + *
+   * Optional. A SQL expression to specify the [default value]
+   * (https://cloud.google.com/bigquery/docs/default-values) for this field.
+   * 
+ * + * string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for defaultValueExpression. + */ + com.google.protobuf.ByteString getDefaultValueExpressionBytes(); } diff --git a/proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/TableProto.java b/proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/TableProto.java index 1e47656907..cae3e55f1b 100644 --- a/proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/TableProto.java +++ b/proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/TableProto.java @@ -48,7 +48,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + ".proto\022 google.cloud.bigquery.storage.v1" + "\032\037google/api/field_behavior.proto\"Q\n\013Tab" + "leSchema\022B\n\006fields\030\001 \003(\01322.google.cloud." - + "bigquery.storage.v1.TableFieldSchema\"\205\005\n" + + "bigquery.storage.v1.TableFieldSchema\"\254\005\n" + "\020TableFieldSchema\022\021\n\004name\030\001 \001(\tB\003\340A\002\022J\n\004" + "type\030\002 \001(\01627.google.cloud.bigquery.stora" + "ge.v1.TableFieldSchema.TypeB\003\340A\002\022J\n\004mode" @@ -57,20 +57,20 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + " \003(\01322.google.cloud.bigquery.storage.v1." + "TableFieldSchemaB\003\340A\001\022\030\n\013description\030\006 \001" + "(\tB\003\340A\001\022\027\n\nmax_length\030\007 \001(\003B\003\340A\001\022\026\n\tprec" - + "ision\030\010 \001(\003B\003\340A\001\022\022\n\005scale\030\t \001(\003B\003\340A\001\"\325\001\n" - + "\004Type\022\024\n\020TYPE_UNSPECIFIED\020\000\022\n\n\006STRING\020\001\022" - + "\t\n\005INT64\020\002\022\n\n\006DOUBLE\020\003\022\n\n\006STRUCT\020\004\022\t\n\005BY" - + "TES\020\005\022\010\n\004BOOL\020\006\022\r\n\tTIMESTAMP\020\007\022\010\n\004DATE\020\010" - + "\022\010\n\004TIME\020\t\022\014\n\010DATETIME\020\n\022\r\n\tGEOGRAPHY\020\013\022" - + "\013\n\007NUMERIC\020\014\022\016\n\nBIGNUMERIC\020\r\022\014\n\010INTERVAL" - + "\020\016\022\010\n\004JSON\020\017\"F\n\004Mode\022\024\n\020MODE_UNSPECIFIED" - + "\020\000\022\014\n\010NULLABLE\020\001\022\014\n\010REQUIRED\020\002\022\014\n\010REPEAT" - + "ED\020\003B\272\001\n$com.google.cloud.bigquery.stora" - + "ge.v1B\nTableProtoP\001Z>cloud.google.com/go" - + "/bigquery/storage/apiv1/storagepb;storag" - + "epb\252\002 Google.Cloud.BigQuery.Storage.V1\312\002" - + " Google\\Cloud\\BigQuery\\Storage\\V1b\006proto" - + "3" + + "ision\030\010 \001(\003B\003\340A\001\022\022\n\005scale\030\t \001(\003B\003\340A\001\022%\n\030" + + "default_value_expression\030\n \001(\tB\003\340A\001\"\325\001\n\004" + + "Type\022\024\n\020TYPE_UNSPECIFIED\020\000\022\n\n\006STRING\020\001\022\t" + + "\n\005INT64\020\002\022\n\n\006DOUBLE\020\003\022\n\n\006STRUCT\020\004\022\t\n\005BYT" + + "ES\020\005\022\010\n\004BOOL\020\006\022\r\n\tTIMESTAMP\020\007\022\010\n\004DATE\020\010\022" + + "\010\n\004TIME\020\t\022\014\n\010DATETIME\020\n\022\r\n\tGEOGRAPHY\020\013\022\013" + + "\n\007NUMERIC\020\014\022\016\n\nBIGNUMERIC\020\r\022\014\n\010INTERVAL\020" + + "\016\022\010\n\004JSON\020\017\"F\n\004Mode\022\024\n\020MODE_UNSPECIFIED\020" + + "\000\022\014\n\010NULLABLE\020\001\022\014\n\010REQUIRED\020\002\022\014\n\010REPEATE" + + "D\020\003B\272\001\n$com.google.cloud.bigquery.storag" + + "e.v1B\nTableProtoP\001Z>cloud.google.com/go/" + + "bigquery/storage/apiv1/storagepb;storage" + + "pb\252\002 Google.Cloud.BigQuery.Storage.V1\312\002 " + + "Google\\Cloud\\BigQuery\\Storage\\V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -92,7 +92,15 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_bigquery_storage_v1_TableFieldSchema_descriptor, new java.lang.String[] { - "Name", "Type", "Mode", "Fields", "Description", "MaxLength", "Precision", "Scale", + "Name", + "Type", + "Mode", + "Fields", + "Description", + "MaxLength", + "Precision", + "Scale", + "DefaultValueExpression", }); com.google.protobuf.ExtensionRegistry registry = com.google.protobuf.ExtensionRegistry.newInstance(); diff --git a/proto-google-cloud-bigquerystorage-v1/src/main/proto/google/cloud/bigquery/storage/v1/table.proto b/proto-google-cloud-bigquerystorage-v1/src/main/proto/google/cloud/bigquery/storage/v1/table.proto index 56f7852a19..c9b62d7932 100644 --- a/proto-google-cloud-bigquerystorage-v1/src/main/proto/google/cloud/bigquery/storage/v1/table.proto +++ b/proto-google-cloud-bigquerystorage-v1/src/main/proto/google/cloud/bigquery/storage/v1/table.proto @@ -164,4 +164,8 @@ message TableFieldSchema { // Optional. See documentation for precision. int64 scale = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A SQL expression to specify the [default value] + // (https://cloud.google.com/bigquery/docs/default-values) for this field. + string default_value_expression = 10 [(google.api.field_behavior) = OPTIONAL]; }