Skip to content

Commit

Permalink
fix: update BigQuerySchemaUtil to use non-deprecated hasExtension
Browse files Browse the repository at this point in the history
This is to unblock protocol buffer version updates.
  • Loading branch information
PhongChuong committed Oct 24, 2024
1 parent 1ea9599 commit 3d76a04
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 3d76a04

Please sign in to comment.