Skip to content

Commit

Permalink
Merge branch 'master' into regen_gocloud
Browse files Browse the repository at this point in the history
  • Loading branch information
codyoss committed Aug 28, 2020
2 parents cf75ef3 + 9e7d7c2 commit 9fcb775
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 2 deletions.
23 changes: 23 additions & 0 deletions bigquery/integration_test.go
Expand Up @@ -2671,6 +2671,29 @@ func TestIntegration_RoutineScalarUDF(t *testing.T) {
}
}

func TestIntegration_RoutineJSUDF(t *testing.T) {
if client == nil {
t.Skip("Integration tests skipped")
}
ctx := context.Background()

// Create a scalar UDF routine via API.
routineID := routineIDs.New()
routine := dataset.Routine(routineID)
err := routine.Create(ctx, &RoutineMetadata{
Language: "JAVASCRIPT", Type: "SCALAR_FUNCTION",
Description: "capitalizes using javascript",
Arguments: []*RoutineArgument{
{Name: "instr", Kind: "FIXED_TYPE", DataType: &StandardSQLDataType{TypeKind: "STRING"}},
},
ReturnType: &StandardSQLDataType{TypeKind: "STRING"},
Body: "return instr.toUpperCase();",
})
if err != nil {
t.Fatalf("Create: %v", err)
}
}

func TestIntegration_RoutineComplexTypes(t *testing.T) {
if client == nil {
t.Skip("Integration tests skipped")
Expand Down
5 changes: 5 additions & 0 deletions bigquery/routine.go
Expand Up @@ -156,6 +156,11 @@ func (rm *RoutineMetadata) toBQ() (*bq.Routine, error) {
r.Language = rm.Language
r.RoutineType = rm.Type
r.DefinitionBody = rm.Body
rt, err := rm.ReturnType.toBQ()
if err != nil {
return nil, err
}
r.ReturnType = rt

var args []*bq.Argument
for _, v := range rm.Arguments {
Expand Down
6 changes: 5 additions & 1 deletion bigquery/routine_test.go
Expand Up @@ -82,6 +82,7 @@ func TestRoutineTypeConversions(t *testing.T) {
Etag: "etag",
RoutineType: "type",
Language: "lang",
ReturnType: &bq.StandardSqlDataType{TypeKind: "INT64"},
},
&RoutineMetadata{
CreationTime: aTime,
Expand All @@ -91,16 +92,19 @@ func TestRoutineTypeConversions(t *testing.T) {
ETag: "etag",
Type: "type",
Language: "lang",
ReturnType: &StandardSQLDataType{TypeKind: "INT64"},
}},
{"body_and_libs", "FromRoutineMetadataToUpdate",
&RoutineMetadataToUpdate{
Body: "body",
ImportedLibraries: []string{"foo", "bar"},
ReturnType: &StandardSQLDataType{TypeKind: "FOO"},
},
&bq.Routine{
DefinitionBody: "body",
ImportedLibraries: []string{"foo", "bar"},
ForceSendFields: []string{"DefinitionBody", "ImportedLibraries"},
ReturnType: &bq.StandardSqlDataType{TypeKind: "FOO"},
ForceSendFields: []string{"DefinitionBody", "ImportedLibraries", "ReturnType"},
}},
{"null_fields", "FromRoutineMetadataToUpdate",
&RoutineMetadataToUpdate{
Expand Down
2 changes: 1 addition & 1 deletion internal/version/version.go
Expand Up @@ -26,7 +26,7 @@ import (

// Repo is the current version of the client libraries in this
// repo. It should be a date in YYYYMMDD format.
const Repo = "20200817"
const Repo = "20200827"

// Go returns the Go runtime version. The returned string
// has no whitespace.
Expand Down
8 changes: 8 additions & 0 deletions logging/CHANGES.md
@@ -1,5 +1,13 @@
# Changes

## v1.1.0

- Support unmarshalling stringified Severity.
- Add exported SetGoogleClientInfo wrappers to manual file.
- Support no payload.
- Update "Grouping Logs by Request" docs.
- Add auto-detection of monitored resources on GAE Standard.

## v1.0.0

This is the first tag to carve out logging as its own module. See:
Expand Down
4 changes: 4 additions & 0 deletions storage/CHANGES.md
@@ -1,5 +1,9 @@
# Changes

## v1.11.0
- Add support for CustomTime and NoncurrentTime object lifecycle management
features.

## v1.10.0
- Bump dependency on google.golang.org/api to capture changes to retry logic
which will make retries on writes more resilient.
Expand Down

0 comments on commit 9fcb775

Please sign in to comment.