[
https://issues.apache.org/jira/browse/BEAM-13796?focusedWorklogId=729906&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-729906
]
ASF GitHub Bot logged work on BEAM-13796:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 18/Feb/22 22:41
Start Date: 18/Feb/22 22:41
Worklog Time Spent: 10m
Work Description: ibzib commented on a change in pull request #16720:
URL: https://github.com/apache/beam/pull/16720#discussion_r810383072
##########
File path:
sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIOStorageQueryTest.java
##########
@@ -753,6 +762,31 @@ public void testQuerySourceCreateReader() throws Exception
{
querySource.createReader(options);
}
+ @Test
+ public void testActuateProjectionPushdown() {
+ org.apache.beam.sdk.schemas.Schema schema =
+ org.apache.beam.sdk.schemas.Schema.builder()
+ .addStringField("foo")
+ .addStringField("bar")
+ .build();
+ TypedRead<Row> read =
+ BigQueryIO.read(
+ record ->
+ BigQueryUtils.toBeamRow(
+ record.getRecord(), schema,
ConversionOptions.builder().build()))
+ .withMethod(Method.DIRECT_READ)
+ .withCoder(SchemaCoder.of(schema));
+
+ assertTrue(read.supportsProjectionPushdown());
+ PTransform<PBegin, PCollection<Row>> pushdownT =
+ read.actuateProjectionPushdown(
+ ImmutableMap.of(new TupleTag<>("output"),
FieldAccessDescriptor.withFieldNames("foo")));
+
+ TypedRead<Row> pushdownRead = (TypedRead<Row>) pushdownT;
+ assertEquals(Method.DIRECT_READ, pushdownRead.getMethod());
+ assertThat(pushdownRead.getSelectedFields().get(),
Matchers.containsInAnyOrder("foo"));
+ }
Review comment:
e2e tests are easier after we add the optimizer to runners.
Added a unit test for supports=false.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 729906)
Time Spent: 1h 10m (was: 1h)
> Projection pushdown in BigQuery IO
> ----------------------------------
>
> Key: BEAM-13796
> URL: https://issues.apache.org/jira/browse/BEAM-13796
> Project: Beam
> Issue Type: New Feature
> Components: io-java-gcp
> Reporter: Kyle Weaver
> Assignee: Kyle Weaver
> Priority: P2
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
> BigQuery IO (read API only) already supports pushdown within Beam SQL
> queries, but we want to support pushdown outside of just SQL.
> To do this, BigQuery Read needs to implement ProjectionProducer.
> https://github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/ProjectionProducer.java
--
This message was sent by Atlassian Jira
(v8.20.1#820001)