houqp commented on a change in pull request #1556:
URL: https://github.com/apache/arrow-datafusion/pull/1556#discussion_r785403551



##########
File path: datafusion/src/avro_to_arrow/reader.rs
##########
@@ -101,30 +100,49 @@ impl ReaderBuilder {
     }
 
     /// Create a new `Reader` from the `ReaderBuilder`
-    pub fn build<'a, R>(self, source: R) -> Result<Reader<'a, R>>
+    pub fn build<R>(self, source: R) -> Result<Reader<R>>
     where
         R: Read + Seek,
     {
         let mut source = source;
 
         // check if schema should be inferred
-        let schema = match self.schema {
-            Some(schema) => schema,
-            None => Arc::new(super::read_avro_schema_from_reader(&mut 
source)?),
-        };
         source.seek(SeekFrom::Start(0))?;
-        Reader::try_new(source, schema, self.batch_size, self.projection)
+        let (mut avro_schemas, mut schema, codec, file_marker) =
+            read::read_metadata(&mut source)?;
+        if let Some(proj) = self.projection {

Review comment:
       I might be missing something here, if this is properly supported by 
arrow2, we don't need to play defense and do the post read projection right? I 
agree with @Igosuki that there is still benefit in saving compute and memory by 
doing this at parsing time.




-- 
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]


Reply via email to