paul-rogers commented on a change in pull request #1696: DRILL-7095: Expose 
table schema (TupleMetadata) to physical operator (EasySubScan)
URL: https://github.com/apache/drill/pull/1696#discussion_r266212977
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/WorkspaceSchemaFactory.java
 ##########
 @@ -572,9 +573,21 @@ public Table getTable(String tableName) {
       }
       final DrillTable table = tables.get(tableKey);
       setMetadataTable(table, tableName);
+      setSchema(table, tableName);
       return table;
     }
 
+    private void setSchema(DrillTable table, String tableName) {
+      if 
(schemaConfig.getOption(ExecConstants.STORE_TABLE_USE_SCHEMA_FILE).bool_val) {
+        try {
+          FsMetastoreSchemaProvider schemaProvider = new 
FsMetastoreSchemaProvider(this, tableName);
+          table.setSchema(schemaProvider.read().getSchema());
+        } catch (IOException e) {
+          logger.debug("Unable to deserialize schema from schema file for 
table: " + tableName, e);
 
 Review comment:
   In the future, this might handle other schema sources than just the file. 
This is a perfectly fine implementation for getting started; just something to 
remember for later.

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