Skip to content

Commit 89c767f

Browse files
feat: add default_value_expression to TableFieldSchema (#1988)
* 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]>
1 parent e6ee13a commit 89c767f

File tree

4 files changed

+244
-16
lines changed

4 files changed

+244
-16
lines changed

proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/TableFieldSchema.java

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ private TableFieldSchema() {
4343
mode_ = 0;
4444
fields_ = java.util.Collections.emptyList();
4545
description_ = "";
46+
defaultValueExpression_ = "";
4647
}
4748

4849
@java.lang.Override
@@ -991,6 +992,59 @@ public long getScale() {
991992
return scale_;
992993
}
993994

995+
public static final int DEFAULT_VALUE_EXPRESSION_FIELD_NUMBER = 10;
996+
997+
@SuppressWarnings("serial")
998+
private volatile java.lang.Object defaultValueExpression_ = "";
999+
/**
1000+
*
1001+
*
1002+
* <pre>
1003+
* Optional. A SQL expression to specify the [default value]
1004+
* (https://cloud.google.com/bigquery/docs/default-values) for this field.
1005+
* </pre>
1006+
*
1007+
* <code>string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
1008+
*
1009+
* @return The defaultValueExpression.
1010+
*/
1011+
@java.lang.Override
1012+
public java.lang.String getDefaultValueExpression() {
1013+
java.lang.Object ref = defaultValueExpression_;
1014+
if (ref instanceof java.lang.String) {
1015+
return (java.lang.String) ref;
1016+
} else {
1017+
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
1018+
java.lang.String s = bs.toStringUtf8();
1019+
defaultValueExpression_ = s;
1020+
return s;
1021+
}
1022+
}
1023+
/**
1024+
*
1025+
*
1026+
* <pre>
1027+
* Optional. A SQL expression to specify the [default value]
1028+
* (https://cloud.google.com/bigquery/docs/default-values) for this field.
1029+
* </pre>
1030+
*
1031+
* <code>string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
1032+
*
1033+
* @return The bytes for defaultValueExpression.
1034+
*/
1035+
@java.lang.Override
1036+
public com.google.protobuf.ByteString getDefaultValueExpressionBytes() {
1037+
java.lang.Object ref = defaultValueExpression_;
1038+
if (ref instanceof java.lang.String) {
1039+
com.google.protobuf.ByteString b =
1040+
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
1041+
defaultValueExpression_ = b;
1042+
return b;
1043+
} else {
1044+
return (com.google.protobuf.ByteString) ref;
1045+
}
1046+
}
1047+
9941048
private byte memoizedIsInitialized = -1;
9951049

9961050
@java.lang.Override
@@ -1033,6 +1087,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
10331087
if (scale_ != 0L) {
10341088
output.writeInt64(9, scale_);
10351089
}
1090+
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(defaultValueExpression_)) {
1091+
com.google.protobuf.GeneratedMessageV3.writeString(output, 10, defaultValueExpression_);
1092+
}
10361093
getUnknownFields().writeTo(output);
10371094
}
10381095

@@ -1070,6 +1127,9 @@ public int getSerializedSize() {
10701127
if (scale_ != 0L) {
10711128
size += com.google.protobuf.CodedOutputStream.computeInt64Size(9, scale_);
10721129
}
1130+
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(defaultValueExpression_)) {
1131+
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(10, defaultValueExpression_);
1132+
}
10731133
size += getUnknownFields().getSerializedSize();
10741134
memoizedSize = size;
10751135
return size;
@@ -1094,6 +1154,7 @@ public boolean equals(final java.lang.Object obj) {
10941154
if (getMaxLength() != other.getMaxLength()) return false;
10951155
if (getPrecision() != other.getPrecision()) return false;
10961156
if (getScale() != other.getScale()) return false;
1157+
if (!getDefaultValueExpression().equals(other.getDefaultValueExpression())) return false;
10971158
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
10981159
return true;
10991160
}
@@ -1123,6 +1184,8 @@ public int hashCode() {
11231184
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getPrecision());
11241185
hash = (37 * hash) + SCALE_FIELD_NUMBER;
11251186
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getScale());
1187+
hash = (37 * hash) + DEFAULT_VALUE_EXPRESSION_FIELD_NUMBER;
1188+
hash = (53 * hash) + getDefaultValueExpression().hashCode();
11261189
hash = (29 * hash) + getUnknownFields().hashCode();
11271190
memoizedHashCode = hash;
11281191
return hash;
@@ -1277,6 +1340,7 @@ public Builder clear() {
12771340
maxLength_ = 0L;
12781341
precision_ = 0L;
12791342
scale_ = 0L;
1343+
defaultValueExpression_ = "";
12801344
return this;
12811345
}
12821346

@@ -1348,6 +1412,9 @@ private void buildPartial0(com.google.cloud.bigquery.storage.v1.TableFieldSchema
13481412
if (((from_bitField0_ & 0x00000080) != 0)) {
13491413
result.scale_ = scale_;
13501414
}
1415+
if (((from_bitField0_ & 0x00000100) != 0)) {
1416+
result.defaultValueExpression_ = defaultValueExpression_;
1417+
}
13511418
}
13521419

13531420
@java.lang.Override
@@ -1448,6 +1515,11 @@ public Builder mergeFrom(com.google.cloud.bigquery.storage.v1.TableFieldSchema o
14481515
if (other.getScale() != 0L) {
14491516
setScale(other.getScale());
14501517
}
1518+
if (!other.getDefaultValueExpression().isEmpty()) {
1519+
defaultValueExpression_ = other.defaultValueExpression_;
1520+
bitField0_ |= 0x00000100;
1521+
onChanged();
1522+
}
14511523
this.mergeUnknownFields(other.getUnknownFields());
14521524
onChanged();
14531525
return this;
@@ -1530,6 +1602,12 @@ public Builder mergeFrom(
15301602
bitField0_ |= 0x00000080;
15311603
break;
15321604
} // case 72
1605+
case 82:
1606+
{
1607+
defaultValueExpression_ = input.readStringRequireUtf8();
1608+
bitField0_ |= 0x00000100;
1609+
break;
1610+
} // case 82
15331611
default:
15341612
{
15351613
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
@@ -2633,6 +2711,117 @@ public Builder clearScale() {
26332711
return this;
26342712
}
26352713

2714+
private java.lang.Object defaultValueExpression_ = "";
2715+
/**
2716+
*
2717+
*
2718+
* <pre>
2719+
* Optional. A SQL expression to specify the [default value]
2720+
* (https://cloud.google.com/bigquery/docs/default-values) for this field.
2721+
* </pre>
2722+
*
2723+
* <code>string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
2724+
*
2725+
* @return The defaultValueExpression.
2726+
*/
2727+
public java.lang.String getDefaultValueExpression() {
2728+
java.lang.Object ref = defaultValueExpression_;
2729+
if (!(ref instanceof java.lang.String)) {
2730+
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
2731+
java.lang.String s = bs.toStringUtf8();
2732+
defaultValueExpression_ = s;
2733+
return s;
2734+
} else {
2735+
return (java.lang.String) ref;
2736+
}
2737+
}
2738+
/**
2739+
*
2740+
*
2741+
* <pre>
2742+
* Optional. A SQL expression to specify the [default value]
2743+
* (https://cloud.google.com/bigquery/docs/default-values) for this field.
2744+
* </pre>
2745+
*
2746+
* <code>string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
2747+
*
2748+
* @return The bytes for defaultValueExpression.
2749+
*/
2750+
public com.google.protobuf.ByteString getDefaultValueExpressionBytes() {
2751+
java.lang.Object ref = defaultValueExpression_;
2752+
if (ref instanceof String) {
2753+
com.google.protobuf.ByteString b =
2754+
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
2755+
defaultValueExpression_ = b;
2756+
return b;
2757+
} else {
2758+
return (com.google.protobuf.ByteString) ref;
2759+
}
2760+
}
2761+
/**
2762+
*
2763+
*
2764+
* <pre>
2765+
* Optional. A SQL expression to specify the [default value]
2766+
* (https://cloud.google.com/bigquery/docs/default-values) for this field.
2767+
* </pre>
2768+
*
2769+
* <code>string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
2770+
*
2771+
* @param value The defaultValueExpression to set.
2772+
* @return This builder for chaining.
2773+
*/
2774+
public Builder setDefaultValueExpression(java.lang.String value) {
2775+
if (value == null) {
2776+
throw new NullPointerException();
2777+
}
2778+
defaultValueExpression_ = value;
2779+
bitField0_ |= 0x00000100;
2780+
onChanged();
2781+
return this;
2782+
}
2783+
/**
2784+
*
2785+
*
2786+
* <pre>
2787+
* Optional. A SQL expression to specify the [default value]
2788+
* (https://cloud.google.com/bigquery/docs/default-values) for this field.
2789+
* </pre>
2790+
*
2791+
* <code>string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
2792+
*
2793+
* @return This builder for chaining.
2794+
*/
2795+
public Builder clearDefaultValueExpression() {
2796+
defaultValueExpression_ = getDefaultInstance().getDefaultValueExpression();
2797+
bitField0_ = (bitField0_ & ~0x00000100);
2798+
onChanged();
2799+
return this;
2800+
}
2801+
/**
2802+
*
2803+
*
2804+
* <pre>
2805+
* Optional. A SQL expression to specify the [default value]
2806+
* (https://cloud.google.com/bigquery/docs/default-values) for this field.
2807+
* </pre>
2808+
*
2809+
* <code>string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
2810+
*
2811+
* @param value The bytes for defaultValueExpression to set.
2812+
* @return This builder for chaining.
2813+
*/
2814+
public Builder setDefaultValueExpressionBytes(com.google.protobuf.ByteString value) {
2815+
if (value == null) {
2816+
throw new NullPointerException();
2817+
}
2818+
checkByteStringIsUtf8(value);
2819+
defaultValueExpression_ = value;
2820+
bitField0_ |= 0x00000100;
2821+
onChanged();
2822+
return this;
2823+
}
2824+
26362825
@java.lang.Override
26372826
public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
26382827
return super.setUnknownFields(unknownFields);

proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/TableFieldSchemaOrBuilder.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,4 +269,31 @@ public interface TableFieldSchemaOrBuilder
269269
* @return The scale.
270270
*/
271271
long getScale();
272+
273+
/**
274+
*
275+
*
276+
* <pre>
277+
* Optional. A SQL expression to specify the [default value]
278+
* (https://cloud.google.com/bigquery/docs/default-values) for this field.
279+
* </pre>
280+
*
281+
* <code>string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
282+
*
283+
* @return The defaultValueExpression.
284+
*/
285+
java.lang.String getDefaultValueExpression();
286+
/**
287+
*
288+
*
289+
* <pre>
290+
* Optional. A SQL expression to specify the [default value]
291+
* (https://cloud.google.com/bigquery/docs/default-values) for this field.
292+
* </pre>
293+
*
294+
* <code>string default_value_expression = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
295+
*
296+
* @return The bytes for defaultValueExpression.
297+
*/
298+
com.google.protobuf.ByteString getDefaultValueExpressionBytes();
272299
}

proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/TableProto.java

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
4848
+ ".proto\022 google.cloud.bigquery.storage.v1"
4949
+ "\032\037google/api/field_behavior.proto\"Q\n\013Tab"
5050
+ "leSchema\022B\n\006fields\030\001 \003(\01322.google.cloud."
51-
+ "bigquery.storage.v1.TableFieldSchema\"\205\005\n"
51+
+ "bigquery.storage.v1.TableFieldSchema\"\254\005\n"
5252
+ "\020TableFieldSchema\022\021\n\004name\030\001 \001(\tB\003\340A\002\022J\n\004"
5353
+ "type\030\002 \001(\01627.google.cloud.bigquery.stora"
5454
+ "ge.v1.TableFieldSchema.TypeB\003\340A\002\022J\n\004mode"
@@ -57,20 +57,20 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
5757
+ " \003(\01322.google.cloud.bigquery.storage.v1."
5858
+ "TableFieldSchemaB\003\340A\001\022\030\n\013description\030\006 \001"
5959
+ "(\tB\003\340A\001\022\027\n\nmax_length\030\007 \001(\003B\003\340A\001\022\026\n\tprec"
60-
+ "ision\030\010 \001(\003B\003\340A\001\022\022\n\005scale\030\t \001(\003B\003\340A\001\"\325\001\n"
61-
+ "\004Type\022\024\n\020TYPE_UNSPECIFIED\020\000\022\n\n\006STRING\020\001\022"
62-
+ "\t\n\005INT64\020\002\022\n\n\006DOUBLE\020\003\022\n\n\006STRUCT\020\004\022\t\n\005BY"
63-
+ "TES\020\005\022\010\n\004BOOL\020\006\022\r\n\tTIMESTAMP\020\007\022\010\n\004DATE\020\010"
64-
+ "\022\010\n\004TIME\020\t\022\014\n\010DATETIME\020\n\022\r\n\tGEOGRAPHY\020\013\022"
65-
+ "\013\n\007NUMERIC\020\014\022\016\n\nBIGNUMERIC\020\r\022\014\n\010INTERVAL"
66-
+ "\020\016\022\010\n\004JSON\020\017\"F\n\004Mode\022\024\n\020MODE_UNSPECIFIED"
67-
+ "\020\000\022\014\n\010NULLABLE\020\001\022\014\n\010REQUIRED\020\002\022\014\n\010REPEAT"
68-
+ "ED\020\003B\272\001\n$com.google.cloud.bigquery.stora"
69-
+ "ge.v1B\nTableProtoP\001Z>cloud.google.com/go"
70-
+ "/bigquery/storage/apiv1/storagepb;storag"
71-
+ "epb\252\002 Google.Cloud.BigQuery.Storage.V1\312\002"
72-
+ " Google\\Cloud\\BigQuery\\Storage\\V1b\006proto"
73-
+ "3"
60+
+ "ision\030\010 \001(\003B\003\340A\001\022\022\n\005scale\030\t \001(\003B\003\340A\001\022%\n\030"
61+
+ "default_value_expression\030\n \001(\tB\003\340A\001\"\325\001\n\004"
62+
+ "Type\022\024\n\020TYPE_UNSPECIFIED\020\000\022\n\n\006STRING\020\001\022\t"
63+
+ "\n\005INT64\020\002\022\n\n\006DOUBLE\020\003\022\n\n\006STRUCT\020\004\022\t\n\005BYT"
64+
+ "ES\020\005\022\010\n\004BOOL\020\006\022\r\n\tTIMESTAMP\020\007\022\010\n\004DATE\020\010\022"
65+
+ "\010\n\004TIME\020\t\022\014\n\010DATETIME\020\n\022\r\n\tGEOGRAPHY\020\013\022\013"
66+
+ "\n\007NUMERIC\020\014\022\016\n\nBIGNUMERIC\020\r\022\014\n\010INTERVAL\020"
67+
+ "\016\022\010\n\004JSON\020\017\"F\n\004Mode\022\024\n\020MODE_UNSPECIFIED\020"
68+
+ "\000\022\014\n\010NULLABLE\020\001\022\014\n\010REQUIRED\020\002\022\014\n\010REPEATE"
69+
+ "D\020\003B\272\001\n$com.google.cloud.bigquery.storag"
70+
+ "e.v1B\nTableProtoP\001Z>cloud.google.com/go/"
71+
+ "bigquery/storage/apiv1/storagepb;storage"
72+
+ "pb\252\002 Google.Cloud.BigQuery.Storage.V1\312\002 "
73+
+ "Google\\Cloud\\BigQuery\\Storage\\V1b\006proto3"
7474
};
7575
descriptor =
7676
com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(
@@ -92,7 +92,15 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
9292
new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
9393
internal_static_google_cloud_bigquery_storage_v1_TableFieldSchema_descriptor,
9494
new java.lang.String[] {
95-
"Name", "Type", "Mode", "Fields", "Description", "MaxLength", "Precision", "Scale",
95+
"Name",
96+
"Type",
97+
"Mode",
98+
"Fields",
99+
"Description",
100+
"MaxLength",
101+
"Precision",
102+
"Scale",
103+
"DefaultValueExpression",
96104
});
97105
com.google.protobuf.ExtensionRegistry registry =
98106
com.google.protobuf.ExtensionRegistry.newInstance();

proto-google-cloud-bigquerystorage-v1/src/main/proto/google/cloud/bigquery/storage/v1/table.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,8 @@ message TableFieldSchema {
164164

165165
// Optional. See documentation for precision.
166166
int64 scale = 9 [(google.api.field_behavior) = OPTIONAL];
167+
168+
// Optional. A SQL expression to specify the [default value]
169+
// (https://cloud.google.com/bigquery/docs/default-values) for this field.
170+
string default_value_expression = 10 [(google.api.field_behavior) = OPTIONAL];
167171
}

0 commit comments

Comments
 (0)