drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [drill] paul-rogers commented on a change in pull request #2026: DRILL-7330: Implement metadata usage for all format plugins
Date Sat, 14 Mar 2020 19:37:13 GMT
paul-rogers 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_r392607198
 
 

 ##########
 File path: exec/java-exec/src/main/java/org/apache/drill/exec/metastore/store/MetastoreFileTableMetadataProvider.java
 ##########
 @@ -291,124 +250,74 @@ public boolean checkMetadataVersion() {
     }
   }
 
-  private ParquetTableMetadataProvider getFallbackTableMetadataProvider() throws IOException
{
-    if (fallback == null) {
-      fallback = fallbackBuilder == null ? null : fallbackBuilder.build();
-    }
-    return fallback;
-  }
+  public static class Builder<T extends Builder<T>> implements FileTableMetadataProviderBuilder<T>
{
+    protected final MetastoreMetadataProviderManager metadataProviderManager;
 
-  private void throwIfChanged() {
-    if (basicTablesRequests.hasMetastoreTableInfoChanged(metastoreTableInfo)) {
-      throw MetadataException.of(MetadataException.MetadataExceptionType.INCONSISTENT_METADATA);
-    }
-  }
+    // builder for fallback ParquetFileTableMetadataProvider
+    // for the case when required metadata is absent in Metastore
+    protected final TableMetadataProviderBuilder fallback;
 
-  public static class Builder implements ParquetFileTableMetadataProviderBuilder {
-    private final MetastoreMetadataProviderManager metadataProviderManager;
+    protected TupleMetadata schema;
 
-    private List<ReadEntryWithPath> entries;
-    private DrillFileSystem fs;
-    private TupleMetadata schema;
+    protected List<String> paths;
 
     private FileSelection selection;
 
-    // builder for fallback ParquetFileTableMetadataProvider
-    // for the case when required metadata is absent in Metastore
-    private final ParquetFileTableMetadataProviderBuilder fallback;
+    private DrillFileSystem fs;
 
     public Builder(MetastoreMetadataProviderManager source) {
-      this.metadataProviderManager = source;
-      this.fallback = new ParquetTableMetadataProviderImpl.Builder(FileSystemMetadataProviderManager.init());
+      this(source, new SimpleFileTableMetadataProvider.Builder(FileSystemMetadataProviderManager.init()));
     }
 
-    @Override
-    public ParquetFileTableMetadataProviderBuilder withEntries(List<ReadEntryWithPath>
entries) {
-      this.entries = entries;
-      fallback.withEntries(entries);
-      return this;
+    protected Builder(MetastoreMetadataProviderManager source, TableMetadataProviderBuilder
fallback) {
+      this.metadataProviderManager = source;
+      this.fallback = fallback;
     }
 
     @Override
-    public ParquetFileTableMetadataProviderBuilder withSelectionRoot(Path selectionRoot)
{
-      fallback.withSelectionRoot(selectionRoot);
-      return this;
+    public T withSchema(TupleMetadata schema) {
 
 Review comment:
   Nice job generalizing this for any kind of builder. I wonder, however, will we need to
create a builder for each format? Or, is there a generic non-Parquet builder which all other
file types can use (at least until it becomes clear that some type would benefit from its
own builder. Avro might be an example since it provides its own schema.)

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message