You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by lz...@apache.org on 2022/02/21 02:29:00 UTC

[flink] branch master updated: [hotfix][avro] Add comments to explain why projection pushdown works for avro bulk format

This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new 9ae6171  [hotfix][avro] Add comments to explain why projection pushdown works for avro bulk format
9ae6171 is described below

commit 9ae617167bfcc1e19e4bf3d3f8dc631eebc7e1cb
Author: tsreaper <ts...@gmail.com>
AuthorDate: Mon Feb 21 10:28:22 2022 +0800

    [hotfix][avro] Add comments to explain why projection pushdown works for avro bulk format
    
    This closes #18717
---
 .../java/org/apache/flink/formats/avro/AvroFileFormatFactory.java   | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/AvroFileFormatFactory.java b/flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/AvroFileFormatFactory.java
index 2d09d93..5e128ec 100644
--- a/flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/AvroFileFormatFactory.java
+++ b/flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/AvroFileFormatFactory.java
@@ -121,6 +121,12 @@ public class AvroFileFormatFactory implements BulkReaderFormatFactory, BulkWrite
                 DynamicTableSource.Context context,
                 DataType physicalDataType,
                 int[][] projections) {
+            // avro is a file format that keeps schemas in file headers,
+            // if the schema given to the reader is not equal to the schema in header,
+            // reader will automatically map the fields and give back records with our desired
+            // schema
+            //
+            // for detailed discussion see comments in https://github.com/apache/flink/pull/18657
             DataType producedDataType = Projection.of(projections).project(physicalDataType);
             return new AvroGenericRecordBulkFormat(
                     context, (RowType) producedDataType.getLogicalType().copy(false));