Skip to content

Commit

Permalink
fix: update BigQuerySchemaUtil to use non-deprecated hasExtension (#2732
Browse files Browse the repository at this point in the history
)

This is to unblock protocol buffer version updates.
  • Loading branch information
PhongChuong authored Oct 24, 2024
1 parent 567f961 commit b97b234
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/
package com.google.cloud.bigquery.storage.v1;

import com.google.protobuf.DescriptorProtos.FieldOptions;
import com.google.protobuf.Descriptors.FieldDescriptor;
import com.google.protobuf.ExtensionLite;
import java.nio.charset.StandardCharsets;
import java.util.Base64;

Expand Down Expand Up @@ -74,8 +76,12 @@ public static String generatePlaceholderFieldName(String fieldName) {
* @return columnName annotation if present, otherwise return the field name.
*/
public static String getFieldName(FieldDescriptor fieldDescriptor) {
return fieldDescriptor.getOptions().hasExtension(AnnotationsProto.columnName)
? fieldDescriptor.getOptions().getExtension(AnnotationsProto.columnName)
return fieldDescriptor
.getOptions()
.hasExtension((ExtensionLite<FieldOptions, String>) AnnotationsProto.columnName)
? fieldDescriptor
.getOptions()
.getExtension((ExtensionLite<FieldOptions, String>) AnnotationsProto.columnName)
: fieldDescriptor.getName();
}
}

0 comments on commit b97b234

Please sign in to comment.