Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.

Commit 91a2bec

Browse files
feat!: use table name create default write stream issue fix (#2119)
* no block table default stream name * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * change default stream name * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent f150780 commit 91a2bec

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/SchemaAwareStreamWriter.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,9 +449,11 @@ public static final class Builder<T> {
449449
private static final String streamPatternString =
450450
"(projects/[^/]+/datasets/[^/]+/tables/[^/]+)/streams/[^/]+";
451451
private static final String tablePatternString = "(projects/[^/]+/datasets/[^/]+/tables/[^/]+)";
452+
private static final String defaultStreamPatternString = tablePatternString + "/_default";
452453

453454
private static final Pattern streamPattern = Pattern.compile(streamPatternString);
454455
private static final Pattern tablePattern = Pattern.compile(tablePatternString);
456+
private static final Pattern defaultStreamPattern = Pattern.compile(defaultStreamPatternString);
455457

456458
/**
457459
* Constructor for SchemaAwareStreamWriter's Builder
@@ -471,7 +473,9 @@ private Builder(
471473
Matcher streamMatcher = streamPattern.matcher(streamOrTableName);
472474
if (!streamMatcher.matches()) {
473475
Matcher tableMatcher = tablePattern.matcher(streamOrTableName);
474-
if (!tableMatcher.matches()) {
476+
Matcher defaultStreamMatcher = defaultStreamPattern.matcher(streamOrTableName);
477+
478+
if (!tableMatcher.matches() && !defaultStreamMatcher.matches()) {
475479
throw new IllegalArgumentException("Invalid name: " + streamOrTableName);
476480
} else {
477481
this.streamName = streamOrTableName + "/_default";

google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1/JsonStreamWriterTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,14 @@ public void testCreateDefaultStream_withNoClientPassedIn() throws Exception {
641641
.build()) {
642642
assertEquals("projects/p/datasets/d/tables/t/_default", writer.getStreamName());
643643
assertEquals("aa", writer.getLocation());
644+
645+
JsonStreamWriter recreate =
646+
JsonStreamWriter.newBuilder(writer.getStreamName(), tableSchema)
647+
.setChannelProvider(channelProvider)
648+
.setCredentialsProvider(NoCredentialsProvider.create())
649+
.setExecutorProvider(InstantiatingExecutorProvider.newBuilder().build())
650+
.setEnableConnectionPool(true)
651+
.build();
644652
}
645653
}
646654

0 commit comments

Comments
 (0)