You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/07/26 23:35:07 UTC

[GitHub] [beam] ibzib commented on a change in pull request #15216: [BEAM-12609] Enable projection pushdown in SchemaIO.

ibzib commented on a change in pull request #15216:
URL: https://github.com/apache/beam/pull/15216#discussion_r677012282



##########
File path: sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/SchemaIOTableProviderWrapper.java
##########
@@ -118,6 +123,34 @@ public Schema getSchema() {
       return begin.apply(readerTransform);
     }
 
+    @Override
+    public PCollection<Row> buildIOReader(
+        PBegin begin, BeamSqlTableFilter filters, List<String> fieldNames) {
+      PTransform<PBegin, PCollection<Row>> readerTransform = schemaIO.buildReader();
+      if (readerTransform instanceof PushdownProjector) {
+        PushdownProjector pushdownProjector = (PushdownProjector) readerTransform;
+        FieldAccessDescriptor fieldAccessDescriptor =
+            FieldAccessDescriptor.withFieldNames(fieldNames);
+        // The pushdown must return a PTransform that can be applied to a PBegin, or this cast will
+        // fail.
+        readerTransform =
+            (PTransform<PBegin, PCollection<Row>>)
+                pushdownProjector.withProjectionPushdown(fieldAccessDescriptor);
+      }

Review comment:
       Done.




-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org