lostluck commented on a change in pull request #12061:
URL: https://github.com/apache/beam/pull/12061#discussion_r444548615
##########
File path: sdks/go/pkg/beam/io/bigqueryio/bigquery.go
##########
@@ -93,18 +93,37 @@ func Read(s beam.Scope, project, table string, t
reflect.Type) beam.PCollection
return query(s, project, fmt.Sprintf("SELECT * from [%v]", table), t)
}
+// QueryOptions represents additional options for executing a query.
+type QueryOptions struct {
+ // UseStandardSQL enables BigQuery's Standard SQL dialect when
executing a query.
+ UseStandardSQL bool
+}
+
+// UseStandardSQL enables BigQuery's Standard SQL dialect when executing a
query.
+func UseStandardSQL(qo *QueryOptions) error {
+ qo.UseStandardSQL = true
+ return nil
+}
Review comment:
Part of the functional options is to have the user level functions
return functions. This allows for closures over user configuration for more
complicated options later on. Probably doesn't matter in this case, but
otherwise:
eg.
```suggestion
func UseStandardSQL() func(qo *QueryOptions) error {
return func(qo *QueryOptions) error
qo.UseStandardSQL = true
return nil
}
}
```
I'd probably drop the "use" so it's just StandardSQL. When there are more
of these, the repeated Use prefix will get tiresome and reduce readability.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]