[ 
https://issues.apache.org/jira/browse/DRILL-7330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17059463#comment-17059463
 ] 

ASF GitHub Bot commented on DRILL-7330:
---------------------------------------

paul-rogers commented on pull request #2026: DRILL-7330: Implement metadata 
usage for all format plugins
URL: https://github.com/apache/drill/pull/2026#discussion_r392609647
 
 

 ##########
 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:
   I suspect I'll need to help with this. The design in this present mechanism 
is that you'd add a "metadata" (should be "implicit") column parser that will 
look for, or insert, the target column. You'd then add a mechanism to populate 
the resulting vector using the `ResultSetLoader`. See `MetadataManager` (which 
should be renamed to avoid confusion with your "real" metadata.) Then, a 
generic merge mechanism combines the reader data, file implicit columns, 
missing (null) columns, and your new implicit column.
   
   As it turns out, this is exactly the bit that I'm slightly revising at the 
moment. (The current design works, and did make explicit what the original code 
was trying to do, but ended up being a bit overly complex itself.) Still we can 
get your PR to work with the existing mechanism, then I can adjust this code as 
needed in my revision.
 
----------------------------------------------------------------
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]


> Implement metadata usage for text format plugin
> -----------------------------------------------
>
>                 Key: DRILL-7330
>                 URL: https://issues.apache.org/jira/browse/DRILL-7330
>             Project: Apache Drill
>          Issue Type: Sub-task
>            Reporter: Arina Ielchiieva
>            Assignee: Vova Vysotskyi
>            Priority: Major
>             Fix For: 1.18.0
>
>
> 1. Change the current group scan to leverage Schema from Metastore;
> 2. Use stats for enabling additional logical planning rules for text format 
> plugin. It will enable such optimizations as limit, filter push and so on.
> + add possibility to pass schema through schema file (using path or table 
> root), inline.
> + check for other enhancements in analyze command



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to