Skip to content

Commit

Permalink
fix: update BQTableSchemaToProtoDescriptor to unblock a protobuf chan…
Browse files Browse the repository at this point in the history
…ge. (#1942)

This is a copy from the internal change cl/500839786.
  • Loading branch information
1e0ng authored Jan 19, 2023
1 parent 2863542 commit 62cc80a
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.google.protobuf.Descriptors;
import com.google.protobuf.Descriptors.Descriptor;
import com.google.protobuf.Descriptors.FileDescriptor;
import com.google.protobuf.ExtensionLite;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -160,7 +161,12 @@ private static FieldDescriptorProto convertBQTableFieldToProtoField(
if (!BigQuerySchemaUtil.isProtoCompatible(fieldName)) {
fieldDescriptor.setName(BigQuerySchemaUtil.generatePlaceholderFieldName(fieldName));
fieldDescriptor.setOptions(
FieldOptions.newBuilder().setExtension(AnnotationsProto.columnName, fieldName).build());
FieldOptions.newBuilder()
.setExtension(
(ExtensionLite<FieldOptions, String>) AnnotationsProto.columnName,
// Remove ExtensionLite after protobuf linkage error is resolved.
fieldName)
.build());
}
return fieldDescriptor.build();
}
Expand Down

0 comments on commit 62cc80a

Please sign in to comment.