Skip to content

Commit

Permalink
feat: add default_value_expression to TableFieldSchema (#1988)
Browse files Browse the repository at this point in the history
* feat: add default_value_expression to TableFieldSchema

PiperOrigin-RevId: 508443364

Source-Link: googleapis/googleapis@fc7d513

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 <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Yiru Tang <[email protected]>
  • Loading branch information
3 people authored Feb 21, 2023
1 parent e6ee13a commit 89c767f
Show file tree
Hide file tree
Showing 4 changed files with 244 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ private TableFieldSchema() {
mode_ = 0;
fields_ = java.util.Collections.emptyList();
description_ = "";
defaultValueExpression_ = "";
}

@java.lang.Override
Expand Down Expand Up @@ -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_ = "";
/**
*
*
* <pre>
* Optional. A SQL expression to specify the [default value]
* (https://cloud.google.com/bigquery/docs/default-values) for this field.
* </pre>
*
* <code>string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @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;
}
}
/**
*
*
* <pre>
* Optional. A SQL expression to specify the [default value]
* (https://cloud.google.com/bigquery/docs/default-values) for this field.
* </pre>
*
* <code>string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @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
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1277,6 +1340,7 @@ public Builder clear() {
maxLength_ = 0L;
precision_ = 0L;
scale_ = 0L;
defaultValueExpression_ = "";
return this;
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -2633,6 +2711,117 @@ public Builder clearScale() {
return this;
}

private java.lang.Object defaultValueExpression_ = "";
/**
*
*
* <pre>
* Optional. A SQL expression to specify the [default value]
* (https://cloud.google.com/bigquery/docs/default-values) for this field.
* </pre>
*
* <code>string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @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;
}
}
/**
*
*
* <pre>
* Optional. A SQL expression to specify the [default value]
* (https://cloud.google.com/bigquery/docs/default-values) for this field.
* </pre>
*
* <code>string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @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;
}
}
/**
*
*
* <pre>
* Optional. A SQL expression to specify the [default value]
* (https://cloud.google.com/bigquery/docs/default-values) for this field.
* </pre>
*
* <code>string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @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;
}
/**
*
*
* <pre>
* Optional. A SQL expression to specify the [default value]
* (https://cloud.google.com/bigquery/docs/default-values) for this field.
* </pre>
*
* <code>string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return This builder for chaining.
*/
public Builder clearDefaultValueExpression() {
defaultValueExpression_ = getDefaultInstance().getDefaultValueExpression();
bitField0_ = (bitField0_ & ~0x00000100);
onChanged();
return this;
}
/**
*
*
* <pre>
* Optional. A SQL expression to specify the [default value]
* (https://cloud.google.com/bigquery/docs/default-values) for this field.
* </pre>
*
* <code>string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,4 +269,31 @@ public interface TableFieldSchemaOrBuilder
* @return The scale.
*/
long getScale();

/**
*
*
* <pre>
* Optional. A SQL expression to specify the [default value]
* (https://cloud.google.com/bigquery/docs/default-values) for this field.
* </pre>
*
* <code>string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The defaultValueExpression.
*/
java.lang.String getDefaultValueExpression();
/**
*
*
* <pre>
* Optional. A SQL expression to specify the [default value]
* (https://cloud.google.com/bigquery/docs/default-values) for this field.
* </pre>
*
* <code>string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The bytes for defaultValueExpression.
*/
com.google.protobuf.ByteString getDefaultValueExpressionBytes();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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(
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

0 comments on commit 89c767f

Please sign in to comment.