vvysotskyi commented on a change in pull request #2026: DRILL-7330: Implement metadata usage for all format plugins URL: https://github.com/apache/drill/pull/2026#discussion_r392719225
########## File path: exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/scan/project/ReaderSchemaOrchestrator.java ########## @@ -118,9 +135,59 @@ public void endBatch() { // Fill in the null and metadata columns. populateNonDataColumns(); } + if (projected) { + setProjectMetadata(null); + } rootTuple.setRowCount(tableContainer.getRecordCount()); } + /** + * Updates {@code PROJECT_METADATA} implicit column value to {@code "FALSE"} to handle current batch as + * a batch with metadata information only for the case when this batch is first and empty. + */ + private boolean resolveProjectingMetadata() { + if (tableContainer.getRecordCount() == 0 && !hasSchema() && eof) { + if (setProjectMetadata(Boolean.FALSE.toString())) { + tableContainer.setValueCount(tableContainer.getRecordCount() + 1); + return true; + } + } + return false; + } + + /** + * Sets {@code PROJECT_METADATA} implicit column value. + * + * @param value value to set + * @return {@code true} if {@code PROJECT_METADATA} implicit column + * is present in scan projection and its value is updated + */ + private boolean setProjectMetadata(String value) { Review comment: It would be great if you can help with this part. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services