Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: user-provided streamOrTableName for default write streams #1155

Merged
merged 3 commits into from Jun 29, 2021

Conversation

anguillanneuf
Copy link
Contributor

@anguillanneuf anguillanneuf commented Jun 29, 2021

Fixes a broken URL in a sample comment.

Also cleans up the docstrings for streamOrTableName in JsonStreamWriter.Builder.

IIUC, createDefaultStream can only be set to True on StreamWriter not JsonStreamWriter, the language below could mislead devs into thinking otherwise because it's not clear which builder it refers to.

* @param streamOrTableName name of the stream that must follow
* "projects/[^/]+/datasets/[^/]+/tables/[^/]+/streams/[^/]+" or if it is default stream
* (createDefaultStream is true on builder), then the name here should be a table name
* ""projects/[^/]+/datasets/[^/]+/tables/[^/]+"

Also it looks like _default is not added by client code but by the library.

private Builder(String streamOrTableName, TableSchema tableSchema, BigQueryWriteClient client) {
Matcher streamMatcher = streamPattern.matcher(streamOrTableName);
if (!streamMatcher.matches()) {
Matcher tableMatcher = tablePattern.matcher(streamOrTableName);
if (!tableMatcher.matches()) {
throw new IllegalArgumentException("Invalid name: " + streamOrTableName);
} else {
this.streamName = streamOrTableName + "/_default";

Not sure if I'm making all the right calls here. Thanks for reviewing!


Also see internal cl/381977832.

@anguillanneuf anguillanneuf requested a review from as a code owner Jun 29, 2021
@anguillanneuf anguillanneuf requested a review from tswast Jun 29, 2021
@google-cla google-cla bot added the cla: yes label Jun 29, 2021
@product-auto-label product-auto-label bot added the api: bigquerystorage label Jun 29, 2021
@stephaniewang526
Copy link
Member

@stephaniewang526 stephaniewang526 commented Jun 29, 2021

Thank you!

@stephaniewang526 stephaniewang526 merged commit fc4a5c0 into master Jun 29, 2021
18 checks passed
@stephaniewang526 stephaniewang526 deleted the default-stream branch Jun 29, 2021
gcf-merge-on-green bot pushed a commit that referenced this issue Jun 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquerystorage cla: yes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants