arina-ielchiieva commented on a change in pull request #1993: DRILL-7601: Shift 
column conversion to reader from scan framework
URL: https://github.com/apache/drill/pull/1993#discussion_r384448178
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/avro/AvroBatchReader.java
 ##########
 @@ -69,11 +69,15 @@ public boolean open(FileScanFramework.FileSchemaNegotiator 
negotiator) {
       negotiator.userName(), 
negotiator.context().getFragmentContext().getQueryUserName());
 
     logger.debug("Avro file schema: {}", reader.getSchema());
-    TupleMetadata schema = AvroSchemaUtil.convert(reader.getSchema());
-    logger.debug("Avro file converted schema: {}", schema);
-    negotiator.setTableSchema(schema, true);
+    TupleMetadata readerSchema = AvroSchemaUtil.convert(reader.getSchema());
+    logger.debug("Avro file converted schema: {}", readerSchema);
+    TupleMetadata providedSchema = negotiator.providedSchema();
+    TupleMetadata tableSchema = 
StandardConversions.mergeSchemas(providedSchema, readerSchema);
 
 Review comment:
   Why reader should merge the schemas? Why not to do this implicitly in 
negotiator? 
   My concern is that the fact the schemas should be merged can be easily 
forgotten during reader implementation...

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to