@@ -603,22 +603,9 @@ private <ReqT, RowT> ServerStreamingCallable<ReadRowsRequest, RowT> createReadRo
603
603
GrpcCallSettings .<ReadRowsRequest , ReadRowsResponse >newBuilder ()
604
604
.setMethodDescriptor (BigtableGrpc .getReadRowsMethod ())
605
605
.setParamsExtractor (
606
- new RequestParamsExtractor <ReadRowsRequest >() {
607
- @ Override
608
- public Map <String , String > extract (ReadRowsRequest readRowsRequest ) {
609
- String tableName = readRowsRequest .getTableName ();
610
- String authorizedViewName = readRowsRequest .getAuthorizedViewName ();
611
- if (tableName .isEmpty ()) {
612
- tableName =
613
- NameUtil .extractTableNameFromAuthorizedViewName (authorizedViewName );
614
- }
615
- return ImmutableMap .of (
616
- "table_name" ,
617
- tableName ,
618
- "app_profile_id" ,
619
- readRowsRequest .getAppProfileId ());
620
- }
621
- })
606
+ r ->
607
+ composeRequestParams (
608
+ r .getAppProfileId (), r .getTableName (), r .getAuthorizedViewName ()))
622
609
.build (),
623
610
readRowsSettings .getRetryableCodes ());
624
611
@@ -742,25 +729,9 @@ public ApiFuture<List<KeyOffset>> futureCall(String s, ApiCallContext apiCallCon
742
729
newBuilder ()
743
730
.setMethodDescriptor (BigtableGrpc .getSampleRowKeysMethod ())
744
731
.setParamsExtractor (
745
- new RequestParamsExtractor <com .google .bigtable .v2 .SampleRowKeysRequest >() {
746
- @ Override
747
- public Map <String , String > extract (
748
- com .google .bigtable .v2 .SampleRowKeysRequest sampleRowKeysRequest ) {
749
- String tableName = sampleRowKeysRequest .getTableName ();
750
- String authorizedViewName =
751
- sampleRowKeysRequest .getAuthorizedViewName ();
752
- if (tableName .isEmpty ()) {
753
- tableName =
754
- NameUtil .extractTableNameFromAuthorizedViewName (
755
- authorizedViewName );
756
- }
757
- return ImmutableMap .of (
758
- "table_name" ,
759
- tableName ,
760
- "app_profile_id" ,
761
- sampleRowKeysRequest .getAppProfileId ());
762
- }
763
- })
732
+ r ->
733
+ composeRequestParams (
734
+ r .getAppProfileId (), r .getTableName (), r .getAuthorizedViewName ()))
764
735
.build (),
765
736
settings .sampleRowKeysSettings ().getRetryableCodes ());
766
737
@@ -823,22 +794,9 @@ private UnaryCallable<BulkMutation, MutateRowsAttemptResult> createMutateRowsBas
823
794
GrpcCallSettings .<MutateRowsRequest , MutateRowsResponse >newBuilder ()
824
795
.setMethodDescriptor (BigtableGrpc .getMutateRowsMethod ())
825
796
.setParamsExtractor (
826
- new RequestParamsExtractor <MutateRowsRequest >() {
827
- @ Override
828
- public Map <String , String > extract (MutateRowsRequest mutateRowsRequest ) {
829
- String tableName = mutateRowsRequest .getTableName ();
830
- String authorizedViewName = mutateRowsRequest .getAuthorizedViewName ();
831
- if (tableName .isEmpty ()) {
832
- tableName =
833
- NameUtil .extractTableNameFromAuthorizedViewName (authorizedViewName );
834
- }
835
- return ImmutableMap .of (
836
- "table_name" ,
837
- tableName ,
838
- "app_profile_id" ,
839
- mutateRowsRequest .getAppProfileId ());
840
- }
841
- })
797
+ r ->
798
+ composeRequestParams (
799
+ r .getAppProfileId (), r .getTableName (), r .getAuthorizedViewName ()))
842
800
.build (),
843
801
settings .bulkMutateRowsSettings ().getRetryableCodes ());
844
802
@@ -1075,18 +1033,7 @@ private UnaryCallable<ReadModifyWriteRow, Row> createReadModifyWriteRowCallable(
1075
1033
.setMethodDescriptor (
1076
1034
BigtableGrpc .getGenerateInitialChangeStreamPartitionsMethod ())
1077
1035
.setParamsExtractor (
1078
- new RequestParamsExtractor <GenerateInitialChangeStreamPartitionsRequest >() {
1079
- @ Override
1080
- public Map <String , String > extract (
1081
- GenerateInitialChangeStreamPartitionsRequest
1082
- generateInitialChangeStreamPartitionsRequest ) {
1083
- return ImmutableMap .of (
1084
- "table_name" ,
1085
- generateInitialChangeStreamPartitionsRequest .getTableName (),
1086
- "app_profile_id" ,
1087
- generateInitialChangeStreamPartitionsRequest .getAppProfileId ());
1088
- }
1089
- })
1036
+ r -> composeRequestParams (r .getAppProfileId (), r .getTableName (), "" ))
1090
1037
.build (),
1091
1038
settings .generateInitialChangeStreamPartitionsSettings ().getRetryableCodes ());
1092
1039
@@ -1155,15 +1102,7 @@ public Map<String, String> extract(
1155
1102
GrpcCallSettings .<ReadChangeStreamRequest , ReadChangeStreamResponse >newBuilder ()
1156
1103
.setMethodDescriptor (BigtableGrpc .getReadChangeStreamMethod ())
1157
1104
.setParamsExtractor (
1158
- new RequestParamsExtractor <ReadChangeStreamRequest >() {
1159
- @ Override
1160
- public Map <String , String > extract (
1161
- ReadChangeStreamRequest readChangeStreamRequest ) {
1162
- return ImmutableMap .of (
1163
- "table_name" , readChangeStreamRequest .getTableName (),
1164
- "app_profile_id" , readChangeStreamRequest .getAppProfileId ());
1165
- }
1166
- })
1105
+ r -> composeRequestParams (r .getAppProfileId (), r .getTableName (), "" ))
1167
1106
.build (),
1168
1107
settings .readChangeStreamSettings ().getRetryableCodes ());
1169
1108
@@ -1313,7 +1252,7 @@ private <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createUserFacin
1313
1252
1314
1253
private Map <String , String > composeRequestParams (
1315
1254
String appProfileId , String tableName , String authorizedViewName ) {
1316
- if (tableName .isEmpty ()) {
1255
+ if (tableName .isEmpty () && ! authorizedViewName . isEmpty () ) {
1317
1256
tableName = NameUtil .extractTableNameFromAuthorizedViewName (authorizedViewName );
1318
1257
}
1319
1258
return ImmutableMap .of ("table_name" , tableName , "app_profile_id" , appProfileId );
0 commit comments