-
Notifications
You must be signed in to change notification settings - Fork 1.1k
BigQuery: adds models API implementation. #5021
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
Conversation
| * ModelInfo modelInfo = beforeModel.toBuilder() | ||
| * .setDescription(newDescription) | ||
| * .build(); | ||
| * Model afterModel = bigquery.update(moddelInfo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: moddel
Note: We have a little program at https://github.com/googleapis/google-cloud-java/blob/master/utilities/snippets.go for copying code samples into JavaDocs, if you want to try that out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the typo. Inclined to add the snippets in a followup and redo the instrumentation then, unless you want this change to get even bigger.
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Model.java
Show resolved
Hide resolved
| break; | ||
| } | ||
| } | ||
| assertTrue(found); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You sure you want to assert this since listing resources is eventually consistent? Could be flakey.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good news, everyone! This should be strongly consistent, per conversation with one of the backend engineers who works on the metadata layer.
Thought: Should this be a separate PR so that it shows up nicely in the changelog? |
...le-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQuery.java
Outdated
Show resolved
Hide resolved
...le-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQuery.java
Show resolved
Hide resolved
| LABELS("labels"), | ||
| LAST_MODIFIED_TIME("lastModifiedTime"), | ||
| LOCATION("location"), | ||
| MODEL_REFERENCE("modelReference"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see model type in the Model class, but not here. At first I thought you were waiting for the enum from Apiary, but I guess not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I called it TYPE, but perhaps MODEL_TYPE is better for the enum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you're right. TYPE seems fine. Less redundant.
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Model.java
Outdated
Show resolved
Hide resolved
...e-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/ModelInfo.java
Outdated
Show resolved
Hide resolved
...lients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/spi/v2/BigQueryRpc.java
Show resolved
Hide resolved
| LABELS("labels"), | ||
| LAST_MODIFIED_TIME("lastModifiedTime"), | ||
| LOCATION("location"), | ||
| MODEL_REFERENCE("modelReference"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you're right. TYPE seems fine. Less redundant.
Codecov Report
@@ Coverage Diff @@
## master #5021 +/- ##
============================================
+ Coverage 50.38% 50.4% +0.01%
- Complexity 23736 23783 +47
============================================
Files 2248 2251 +3
Lines 226471 226789 +318
Branches 24954 24968 +14
============================================
+ Hits 114109 114314 +205
- Misses 103770 103870 +100
- Partials 8592 8605 +13
Continue to review full report at Codecov.
|
|
The failing kokoro OSX Java 8 test is related to datastore, not BQ. Will proceed with submit. |
BigQuery: adds models API implementation.
This change adds support for BigQuery ML models as an API resource independent from the previous
ML-As-A-Table variant that existed during beta. It mirrors much of the interactions with Tables, so there's a corresponding ModelId for encapsulating the model reference, ModelInfo for the model metadata, and Model which has service awareness and can be invoked for operations like get/reload.
This initial change does NOT include the extended statistical information from models related to training runs, nor does it include ML feature and labelling column information. That will come in a subsequent change. This change exposes the model type (e.g. LINEAR_REGRESSION), and the ability to do operations like mutate the description/friendlyname/labels.
I've also marked one of the BigQuery methods deprecated due to ambiguous type signature.
boolean delete(String datasetId, String tableId);
When tables were the only kind of resource in a dataset, being able to specify the table via a string was sufficient. However, now that we have independent resource collection kinds within a dataset container, the signature for deletion needs to use more strongly qualified identifiers.
REVIEWER NOTE
I've overridden pom.xml temporarily to pin to an older version of google-api-services-bigquery which will allow testing. The BigQuery service is rolling out the changes necessary so that this no longer needs pinning, but this change is not appropriate for submission until that is complete.