drill-dev mailing list archives

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

 ##########
 File path: exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyGroupScan.java
 ##########
 @@ -333,21 +338,73 @@ public boolean canPushdownProjects(List<SchemaPath> columns)
{
   }
 
   @JsonProperty
+  @JsonIgnore(value = false)
   public TupleMetadata getSchema() {
     return getTableMetadata().getSchema();
   }
 
   @Override
-  @JsonIgnore
-  public TableMetadata getTableMetadata() {
-    if (tableMetadata == null) {
-      tableMetadata = metadataProvider.getTableMetadata();
+  public AnalyzeInfoProvider getAnalyzeInfoProvider() {
+    return new AnalyzeFileInfoProviderImpl(formatPlugin.getName());
+  }
+
+  @Override
+  protected GroupScanWithMetadataFilterer<?> getFilterer() {
+    return new EasyGroupScanFilterer(this);
+  }
+
+  @Override
+  protected FileTableMetadataProviderBuilder<?> tableMetadataProviderBuilder(MetadataProviderManager
source) {
+    if (source.usesMetastore()) {
+      return new MetastoreFileTableMetadataProvider.Builder<>((MetastoreMetadataProviderManager)
source);
+    } else {
+      return defaultTableMetadataProviderBuilder(source);
     }
-    return tableMetadata;
   }
 
   @Override
-  public TableMetadataProvider getMetadataProvider() {
-    return metadataProvider;
+  protected FileTableMetadataProviderBuilder<?> defaultTableMetadataProviderBuilder(MetadataProviderManager
source) {
+    return new SimpleFileTableMetadataProvider.Builder(source);
+  }
+
+  /**
+   * Implementation of GroupScanWithMetadataFilterer which uses {@link EasyGroupScan} as
source and
+   * builds {@link EasyGroupScan} instance with filtered metadata.
+   */
+  private static class EasyGroupScanFilterer extends GroupScanWithMetadataFilterer<EasyGroupScanFilterer>
{
+
+    EasyGroupScanFilterer(EasyGroupScan source) {
+      super(source);
+    }
+
+    @Override
+    public AbstractGroupScanWithMetadata<?> build() {
+      EasyGroupScan newScan = new EasyGroupScan((EasyGroupScan) source);
+      newScan.tableMetadata = tableMetadata;
+      // updates common row count and nulls counts for every column
+      if (newScan.getTableMetadata() != null && files != null && newScan.getFilesMetadata().size()
!= files.size()) {
+        newScan.tableMetadata = TableMetadataUtils.updateRowCount(newScan.getTableMetadata(),
files.values());
+      }
+      newScan.partitions = partitions;
+      newScan.segments = segments;
+      newScan.files = files;
+      newScan.matchAllMetadata = matchAllMetadata;
+      newScan.nonInterestingColumnsMetadata = nonInterestingColumnsMetadata;
+
+      newScan.fileSet = newScan.getFilesMetadata().keySet();
+      newScan.selection = FileSelection.create(null, new ArrayList<>(newScan.fileSet),
newScan.selectionRoot);
+      try {
+        newScan.initFromSelection(newScan.selection, newScan.formatPlugin);
+      } catch (IOException e) {
+        throw new RuntimeException("Failed to initialize scan from the selection.", e);
 
 Review comment:
   Just runtime?

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