Skip to content
This repository has been archived by the owner on Nov 11, 2022. It is now read-only.

Allow overriding flattenResults when reading with BigQueryIO.Read.fromQuery #85

Closed
nevillelyh opened this issue Dec 3, 2015 · 3 comments

Comments

@nevillelyh
Copy link
Contributor

Just realized that BigQueryIO now supports reading fromQuery. It'll be nice if it allows overriding flattenResults to false so that we can retain nested/repeated records in some cases, e.g. mapping to Avro.

https://github.com/GoogleCloudPlatform/DataflowJavaSDK/blob/master/sdk/src/main/java/com/google/cloud/dataflow/sdk/util/BigQueryTableRowIterator.java#L334

@nevillelyh
Copy link
Contributor Author

Also I'm creating a view to get output schema without executing the query, as suggested in this ticket, and realize that there's no way to flatten result when creating the view. So with a query like SELECT field1, field2.f2a.f2b ... I'll get different schema from the view vs actual result:

View schema: {"field1": ..., "field2": {"f2a": ..., "f2b": ...}}
Output schema: {"field1": ..., "field2_f2a_f2b": ...}

@davorbonaci
Copy link
Contributor

I agree that having this flag exposed would be nice. It is a fairly trivial change too.

Some background: there are several BigQuery flags that could be beneficial to Dataflow users. So far, we have been exposing one-by-one on-demand. It would be even better if we had a general way of interacting with BigQuery through Dataflow in a way that exposes all the richness of the BigQuery API.

@dhalperi
Copy link
Contributor

dhalperi commented Feb 2, 2016

Fixed in today's push by b08ec20

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants