Skip to content

Commit 4a5b10c

Browse files
committed
fix according to PR
1 parent 810a94e commit 4a5b10c

2 files changed

Lines changed: 7 additions & 29 deletions

File tree

google-cloud-bigtable/clirr-ignored-differences.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,4 +308,10 @@
308308
<className>com/google/cloud/bigtable/data/v2/models/Heartbeat</className>
309309
<method>*getEstimatedLowWatermarkTime()</method>
310310
</difference>
311+
<difference>
312+
<!-- TargetId is an InternalApi-->
313+
<differenceType>7012</differenceType>
314+
<className>com/google/cloud/bigtable/data/v2/models/TargetId</className>
315+
<method>*scopedForMaterializedView()</method>
316+
</difference>
311317
</differences>

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/NameUtil.java

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -109,35 +109,7 @@ public static String extractMaterializedViewIdFromMaterializedViewName(
109109
/** A helper to convert fully qualified tableName andauthorizedViewName to a {@link TargetId} */
110110
public static TargetId extractTargetId(
111111
@Nonnull String tableName, @Nonnull String authorizedViewName) {
112-
if (tableName.isEmpty() && authorizedViewName.isEmpty()) {
113-
throw new IllegalArgumentException(
114-
"Either table name, authorized view name or materialized view name must be specified. Table name: "
115-
+ tableName
116-
+ ", authorized view name: "
117-
+ authorizedViewName);
118-
}
119-
int names = 0;
120-
if (!tableName.isEmpty()) {
121-
++names;
122-
}
123-
if (!authorizedViewName.isEmpty()) {
124-
++names;
125-
}
126-
if (names > 1) {
127-
throw new IllegalArgumentException(
128-
"Only one of table name and authorized view name can be specified at the same time. Table name: "
129-
+ tableName
130-
+ ", authorized view name: "
131-
+ authorizedViewName);
132-
}
133-
134-
if (!tableName.isEmpty()) {
135-
String tableId = extractTableIdFromTableName(tableName);
136-
return TableId.of(tableId);
137-
}
138-
String tableId = extractTableIdFromAuthorizedViewName(authorizedViewName);
139-
String authorizedViewId = extractAuthorizedViewIdFromAuthorizedViewName(authorizedViewName);
140-
return AuthorizedViewId.of(tableId, authorizedViewId);
112+
return extractTargetId(tableName, authorizedViewName, "");
141113
}
142114

143115
/**

0 commit comments

Comments
 (0)