8000 BigQuery: Add routines support by shollyman · Pull Request #5591 · googleapis/google-cloud-java · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@shollyman
Copy link
Contributor
@shollyman shollyman commented Jun 28, 2019

This adds java support for bigquery routines, which enables API access to a persistent functions and (soon) stored procedures. Routines exist inside of BigQuery datasets, just like tables and BQML models.

UDF documentation:
https://cloud.google.com/bigquery/docs/reference/standard-sql/user-defined-functions
Routines REST documentation:
https://cloud.google.com/bigquery/docs/reference/rest/v2/routines

This PR adds:
CRUD operations for manipulating Routine resources. It models the same structure used for Tables and Models. There's a RoutineId class for the qualified reference, a RoutineInfo for metadata and a Routine class for binding to the service operations like create/update/delete. Submessages like arguments (RoutineArgument) are also implemented as classes.

StandardSQLDataType,StandardSQLField,StandardSQLStructType veneers for communicating type information using standard sql typing. These are used for communicating datatype information for inputs/outputs in routines.

Augments query stats: In addition to using the API directly, you can also manipulate routines using the query language (e.g. CREATE FUNCTION ... AS ...). Statistics provided as part of the query job include the statement type, and when using appropriate DDL queries the DDL target routine.

There's some other cleanup around typos/docs, as well as filling in missing things like statements in the StatementType enum.

@shollyman shollyman requested a review from a team as a code owner June 28, 2019 18:38
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 28, 2019
@shollyman shollyman added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jun 28, 2019
@shollyman
Copy link
Contributor Author

Failure is due to unrelated flaky test in BQ, sent #5592 to address.

@codecov
Copy link
codecov bot commented Jul 8, 2019

Codecov Report

Merging #5591 into master will increase coverage by 0.37%.
The diff coverage is 53.65%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #5591      +/-   ##
============================================
+ Coverage     46.71%   47.09%   +0.37%     
- Complexity    24647    25078     +431     
============================================
  Files          2351     2389      +38     
  Lines        256185   259732    +3547     
  Branches      29333    29397      +64     
============================================
+ Hits         119688   122317    +2629     
- Misses       127575   128454     +879     
- Partials       8922     8961      +39
Impacted Files Coverage Δ Complexity Δ
.../com/google/cloud/bigquery/spi/v2/BigQueryRpc.java 77.77% <ø> (ø) 0 <0> (ø) ⬇️
...e/cloud/bigquery/testing/RemoteBigQueryHelper.java 61.4% <0%> (-1.1%) 6 <0> (ø)
...n/java/com/google/cloud/bigquery/BigQueryImpl.java 66.78% <0%> (-13.22%) 57 <0> (ø)
.../google/cloud/bigquery/spi/v2/HttpBigQueryRpc.java 5.3% <0%> (-0.8%) 2 <0> (ø)
.../java/com/google/cloud/bigquery/JobStatistics.java 93.91% <100%> (+0.34%) 13 <0> (ø) ⬇️
...in/java/com/google/cloud/bigquery/RoutineInfo.java 66.95% <66.95%> (ø) 20 <20> (?)
...com/google/cloud/bigquery/StandardSQLDataType.java 75% <75%> (ø) 7 <7> (?)
...main/java/com/google/cloud/bigquery/RoutineId.java 76.92% <76.92%> (ø) 13 <13> (?)
.../main/java/com/google/cloud/bigquery/BigQuery.java 78.75% <80.76%> (+0.31%) 0 <0> (ø) ⬇️
...c/main/java/com/google/cloud/bigquery/Routine.java 82.35% <82.35%> (ø) 11 <11> (?)
... and 46 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d67dc01...d9a549d. Read the comment docs.

@shollyman shollyman removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jul 9, 2019
@shollyman shollyman requested a review from tswast July 9, 2019 17:35
}

/** Returns an option to specify the maximum number of models returned per page. */
public static RoutineListOption pageSize(long pageSize) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be package private? (Same with other public methods in package private classes)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably reasonable, we extend Option but don't appear to extend each of the various typed options beyond that. Filed https://github.com/googleapis/google-cloud-java/issues/5728 to followup on visibility more generally.

@chingor13 chingor13 changed the title bigquery: add routines support BigQuery: Add routines support Jul 11, 2019
@shollyman shollyman merged commit 7d4f53f into googleapis:master Jul 12, 2019
@shollyman shollyman deleted the routines branch July 12, 2019 16:01
@JesseLovelace JesseLovelace mentioned this pull request Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

0