Skip to content

Commit

Permalink
feat: provide the default stream name (#2444)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomrussello committed Mar 13, 2024
1 parent 6e267fb commit fe9c3ae
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,11 @@ public static void setMaxRequestCallbackWaitTime(Duration waitTime) {
ConnectionWorker.MAXIMUM_REQUEST_CALLBACK_WAIT_TIME = waitTime;
}

/** @return the default stream name associated with tableName */
public static String getDefaultStreamName(TableName tableName) {
return tableName + defaultStreamMatching;
}

long getCreationTimestamp() {
return creationTimestamp;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2224,4 +2224,14 @@ public void testExclusiveAppendSuccessAndNonRetryableError() throws Exception {
Status.Code.INVALID_ARGUMENT,
((StatusRuntimeException) ex.getCause()).getStatus().getCode());
}

@Test
public void testGetDefaultStreamName() {
TableName tableName = TableName.of("projectId", "datasetId", "tableId");

String actualDefaultName = StreamWriter.getDefaultStreamName(tableName);

assertEquals(
"projects/projectId/datasets/datasetId/tables/tableId/_default", actualDefaultName);
}
}

0 comments on commit fe9c3ae

Please sign in to comment.