[jira] [Work logged] (BEAM-5684) Need a test that verifies Flattening / not-flattening of BQ nested records
[ https://issues.apache.org/jira/browse/BEAM-5684?focusedWorklogId=152986&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-152986 ] ASF GitHub Bot logged work on BEAM-5684: Author: ASF GitHub Bot Created on: 10/Oct/18 00:20 Start Date: 10/Oct/18 00:20 Worklog Time Spent: 10m Work Description: pabloem closed pull request #6609: [BEAM-5684] Adding a BQNestedRecords Test URL: https://github.com/apache/beam/pull/6609 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryNestedRecordsIT.java b/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryNestedRecordsIT.java new file mode 100644 index 000..7a22f623f29 --- /dev/null +++ b/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryNestedRecordsIT.java @@ -0,0 +1,160 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.beam.sdk.io.gcp.bigquery; + +import com.google.api.services.bigquery.model.TableRow; +import org.apache.beam.sdk.Pipeline; +import org.apache.beam.sdk.io.gcp.testing.BigqueryClient; +import org.apache.beam.sdk.options.Default; +import org.apache.beam.sdk.options.Description; +import org.apache.beam.sdk.options.PipelineOptions; +import org.apache.beam.sdk.options.PipelineOptionsFactory; +import org.apache.beam.sdk.testing.PAssert; +import org.apache.beam.sdk.testing.TestPipeline; +import org.apache.beam.sdk.testing.TestPipelineOptions; +import org.apache.beam.sdk.transforms.Create; +import org.apache.beam.sdk.transforms.DoFn; +import org.apache.beam.sdk.transforms.ParDo; +import org.apache.beam.sdk.transforms.View; +import org.apache.beam.sdk.values.PCollection; +import org.apache.beam.sdk.values.PCollectionView; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +/** An example that exports nested BigQuery record to a file. */ +@RunWith(JUnit4.class) +public class BigQueryNestedRecordsIT { + private static final String RECORD_QUERY = + "SELECT city.* FROM [apache-beam-testing:big_query_nested_test.source_table]"; + + private static final String UNFLATTENABLE_QUERY = + "SELECT * FROM [apache-beam-testing:big_query_nested_test.genomics_2]"; + + private static Integer stringifyCount = 0; + + /** Options supported by this class. */ + public interface Options extends PipelineOptions { + +@Description("Query for the pipeline input. Must return exactly one result") +@Default.String(RECORD_QUERY) +String getInput(); + +void setInput(String value); + +@Description("Query for unflattenable input. Must return exactly one result") +@Default.String(UNFLATTENABLE_QUERY) +String getUnflattenableInput(); + +void setunflattenableInput(String value); + } + + @Test + public void testNestedRecords() throws Exception { +PipelineOptionsFactory.register(Options.class); +TestPipelineOptions testOptions = +TestPipeline.testingPipelineOptions().as(TestPipelineOptions.class); +Options options = testOptions.as(Options.class); +options.setTempLocation(testOptions.getTempRoot() + "/temp-it/"); +runPipeline(options); + } + + private static void runPipeline(Options options) throws Exception { +// Create flattened and unflattened collections via Dataflow, via normal and side input +// paths. +Pipeline p = Pipeline.create(options); +BigQueryOptions bigQueryOptions = options.as(BigQueryOptions.class); + +PCollection flattenedCollection = +p.apply("ReadFlattened", BigQueryIO.readTableRows().fromQuery(options.getInput())); +PCollection nonFlattenedCollection = +p.apply( +"ReadNonFlattened", + BigQueryIO.readTableRows().fromQuery(options.getInput()).withoutResultFlattening(
[jira] [Work logged] (BEAM-5684) Need a test that verifies Flattening / not-flattening of BQ nested records
[ https://issues.apache.org/jira/browse/BEAM-5684?focusedWorklogId=152982&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-152982 ] ASF GitHub Bot logged work on BEAM-5684: Author: ASF GitHub Bot Created on: 10/Oct/18 00:14 Start Date: 10/Oct/18 00:14 Worklog Time Spent: 10m Work Description: jasonkuster commented on issue #6609: [BEAM-5684] Adding a BQNestedRecords Test URL: https://github.com/apache/beam/pull/6609#issuecomment-428395276 LGTM This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 152982) Time Spent: 1h 40m (was: 1.5h) > Need a test that verifies Flattening / not-flattening of BQ nested records > -- > > Key: BEAM-5684 > URL: https://issues.apache.org/jira/browse/BEAM-5684 > Project: Beam > Issue Type: Bug > Components: io-java-gcp >Reporter: Pablo Estrada >Assignee: Pablo Estrada >Priority: Major > Time Spent: 1h 40m > Remaining Estimate: 0h > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Work logged] (BEAM-5684) Need a test that verifies Flattening / not-flattening of BQ nested records
[ https://issues.apache.org/jira/browse/BEAM-5684?focusedWorklogId=152909&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-152909 ] ASF GitHub Bot logged work on BEAM-5684: Author: ASF GitHub Bot Created on: 09/Oct/18 20:16 Start Date: 09/Oct/18 20:16 Worklog Time Spent: 10m Work Description: pabloem commented on issue #6609: [BEAM-5684] Adding a BQNestedRecords Test URL: https://github.com/apache/beam/pull/6609#issuecomment-428335708 Run Java PreCommit This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 152909) Time Spent: 1.5h (was: 1h 20m) > Need a test that verifies Flattening / not-flattening of BQ nested records > -- > > Key: BEAM-5684 > URL: https://issues.apache.org/jira/browse/BEAM-5684 > Project: Beam > Issue Type: Bug > Components: io-java-gcp >Reporter: Pablo Estrada >Assignee: Pablo Estrada >Priority: Major > Time Spent: 1.5h > Remaining Estimate: 0h > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Work logged] (BEAM-5684) Need a test that verifies Flattening / not-flattening of BQ nested records
[ https://issues.apache.org/jira/browse/BEAM-5684?focusedWorklogId=152821&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-152821 ] ASF GitHub Bot logged work on BEAM-5684: Author: ASF GitHub Bot Created on: 09/Oct/18 17:38 Start Date: 09/Oct/18 17:38 Worklog Time Spent: 10m Work Description: pabloem commented on issue #6609: [BEAM-5684] Adding a BQNestedRecords Test URL: https://github.com/apache/beam/pull/6609#issuecomment-428283083 Run Java PostCommit This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 152821) Time Spent: 1h 20m (was: 1h 10m) > Need a test that verifies Flattening / not-flattening of BQ nested records > -- > > Key: BEAM-5684 > URL: https://issues.apache.org/jira/browse/BEAM-5684 > Project: Beam > Issue Type: Bug > Components: io-java-gcp >Reporter: Pablo Estrada >Assignee: Pablo Estrada >Priority: Major > Time Spent: 1h 20m > Remaining Estimate: 0h > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Work logged] (BEAM-5684) Need a test that verifies Flattening / not-flattening of BQ nested records
[ https://issues.apache.org/jira/browse/BEAM-5684?focusedWorklogId=152518&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-152518 ] ASF GitHub Bot logged work on BEAM-5684: Author: ASF GitHub Bot Created on: 09/Oct/18 05:09 Start Date: 09/Oct/18 05:09 Worklog Time Spent: 10m Work Description: pabloem commented on issue #6609: [BEAM-5684] Adding a BQNestedRecords Test URL: https://github.com/apache/beam/pull/6609#issuecomment-428061677 Run Java PostCommit This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 152518) Time Spent: 1h 10m (was: 1h) > Need a test that verifies Flattening / not-flattening of BQ nested records > -- > > Key: BEAM-5684 > URL: https://issues.apache.org/jira/browse/BEAM-5684 > Project: Beam > Issue Type: Bug > Components: io-java-gcp >Reporter: Pablo Estrada >Assignee: Pablo Estrada >Priority: Major > Time Spent: 1h 10m > Remaining Estimate: 0h > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Work logged] (BEAM-5684) Need a test that verifies Flattening / not-flattening of BQ nested records
[ https://issues.apache.org/jira/browse/BEAM-5684?focusedWorklogId=152516&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-152516 ] ASF GitHub Bot logged work on BEAM-5684: Author: ASF GitHub Bot Created on: 09/Oct/18 05:03 Start Date: 09/Oct/18 05:03 Worklog Time Spent: 10m Work Description: pabloem commented on issue #6609: [BEAM-5684] Adding a BQNestedRecords Test URL: https://github.com/apache/beam/pull/6609#issuecomment-428060691 Run Java PostCommit This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 152516) Time Spent: 1h (was: 50m) > Need a test that verifies Flattening / not-flattening of BQ nested records > -- > > Key: BEAM-5684 > URL: https://issues.apache.org/jira/browse/BEAM-5684 > Project: Beam > Issue Type: Bug > Components: io-java-gcp >Reporter: Pablo Estrada >Assignee: Pablo Estrada >Priority: Major > Time Spent: 1h > Remaining Estimate: 0h > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Work logged] (BEAM-5684) Need a test that verifies Flattening / not-flattening of BQ nested records
[ https://issues.apache.org/jira/browse/BEAM-5684?focusedWorklogId=152481&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-152481 ] ASF GitHub Bot logged work on BEAM-5684: Author: ASF GitHub Bot Created on: 09/Oct/18 00:23 Start Date: 09/Oct/18 00:23 Worklog Time Spent: 10m Work Description: pabloem commented on issue #6609: [BEAM-5684] Adding a BQNestedRecords Test URL: https://github.com/apache/beam/pull/6609#issuecomment-428019853 Run Java PostCommit This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 152481) Time Spent: 50m (was: 40m) > Need a test that verifies Flattening / not-flattening of BQ nested records > -- > > Key: BEAM-5684 > URL: https://issues.apache.org/jira/browse/BEAM-5684 > Project: Beam > Issue Type: Bug > Components: io-java-gcp >Reporter: Pablo Estrada >Assignee: Pablo Estrada >Priority: Major > Time Spent: 50m > Remaining Estimate: 0h > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Work logged] (BEAM-5684) Need a test that verifies Flattening / not-flattening of BQ nested records
[ https://issues.apache.org/jira/browse/BEAM-5684?focusedWorklogId=152422&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-152422 ] ASF GitHub Bot logged work on BEAM-5684: Author: ASF GitHub Bot Created on: 08/Oct/18 21:44 Start Date: 08/Oct/18 21:44 Worklog Time Spent: 10m Work Description: pabloem commented on issue #6609: [BEAM-5684] Adding a BQNestedRecords Test URL: https://github.com/apache/beam/pull/6609#issuecomment-427989264 Run Dataflow ValidatesRunner This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 152422) Time Spent: 0.5h (was: 20m) > Need a test that verifies Flattening / not-flattening of BQ nested records > -- > > Key: BEAM-5684 > URL: https://issues.apache.org/jira/browse/BEAM-5684 > Project: Beam > Issue Type: Bug > Components: io-java-gcp >Reporter: Pablo Estrada >Assignee: Pablo Estrada >Priority: Major > Time Spent: 0.5h > Remaining Estimate: 0h > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Work logged] (BEAM-5684) Need a test that verifies Flattening / not-flattening of BQ nested records
[ https://issues.apache.org/jira/browse/BEAM-5684?focusedWorklogId=152423&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-152423 ] ASF GitHub Bot logged work on BEAM-5684: Author: ASF GitHub Bot Created on: 08/Oct/18 21:44 Start Date: 08/Oct/18 21:44 Worklog Time Spent: 10m Work Description: pabloem commented on issue #6609: [BEAM-5684] Adding a BQNestedRecords Test URL: https://github.com/apache/beam/pull/6609#issuecomment-427989357 Run Java PostCommit This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 152423) Time Spent: 40m (was: 0.5h) > Need a test that verifies Flattening / not-flattening of BQ nested records > -- > > Key: BEAM-5684 > URL: https://issues.apache.org/jira/browse/BEAM-5684 > Project: Beam > Issue Type: Bug > Components: io-java-gcp >Reporter: Pablo Estrada >Assignee: Pablo Estrada >Priority: Major > Time Spent: 40m > Remaining Estimate: 0h > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Work logged] (BEAM-5684) Need a test that verifies Flattening / not-flattening of BQ nested records
[ https://issues.apache.org/jira/browse/BEAM-5684?focusedWorklogId=152421&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-152421 ] ASF GitHub Bot logged work on BEAM-5684: Author: ASF GitHub Bot Created on: 08/Oct/18 21:44 Start Date: 08/Oct/18 21:44 Worklog Time Spent: 10m Work Description: pabloem removed a comment on issue #6609: [BEAM-5684] Adding a BQNestedRecords Test URL: https://github.com/apache/beam/pull/6609#issuecomment-427988596 Run Java Dataflow PostCommit This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 152421) Time Spent: 20m (was: 10m) > Need a test that verifies Flattening / not-flattening of BQ nested records > -- > > Key: BEAM-5684 > URL: https://issues.apache.org/jira/browse/BEAM-5684 > Project: Beam > Issue Type: Bug > Components: io-java-gcp >Reporter: Pablo Estrada >Assignee: Pablo Estrada >Priority: Major > Time Spent: 20m > Remaining Estimate: 0h > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Work logged] (BEAM-5684) Need a test that verifies Flattening / not-flattening of BQ nested records
[ https://issues.apache.org/jira/browse/BEAM-5684?focusedWorklogId=152420&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-152420 ] ASF GitHub Bot logged work on BEAM-5684: Author: ASF GitHub Bot Created on: 08/Oct/18 21:42 Start Date: 08/Oct/18 21:42 Worklog Time Spent: 10m Work Description: pabloem commented on issue #6609: [BEAM-5684] Adding a BQNestedRecords Test URL: https://github.com/apache/beam/pull/6609#issuecomment-427988596 Run Java Dataflow PostCommit This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 152420) Time Spent: 10m Remaining Estimate: 0h > Need a test that verifies Flattening / not-flattening of BQ nested records > -- > > Key: BEAM-5684 > URL: https://issues.apache.org/jira/browse/BEAM-5684 > Project: Beam > Issue Type: Bug > Components: io-java-gcp >Reporter: Pablo Estrada >Assignee: Pablo Estrada >Priority: Major > Time Spent: 10m > Remaining Estimate: 0h > -- This message was sent by Atlassian JIRA (v7.6.3#76005)