File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1 Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,17 @@ private static ProtoSchema convertInternal(
102102 enumTypes .add (enumFullName );
103103 }
104104 }
105+ // The protobuf payload will be decoded as proto2 on the server side. The schema is also
106+ // specified as proto2. Hence we must clear proto3-only features. This works since proto2 and
107+ // proto3 are binary-compatible.
108+ if (resultField .hasProto3Optional ()) {
109+ // Clear proto3-only features
110+ resultField .clearProto3Optional ();
111+ }
112+ if (resultField .hasOneofIndex ()) {
113+ // Clear proto3-only features
114+ resultField .clearOneofIndex ();
115+ }
105116 resultProto .addField (resultField );
106117 }
107118 structTypes .add (protoFullName );
You can’t perform that action at this time.
0 commit comments