Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DRILL-7089: Implement caching for TableMetadataProvider at query leve…
…l and adapt statistics to use Drill metastore API closes #1728
- Loading branch information
1 parent
579ebca
commit 455cee7
Showing
50 changed files
with
1,528 additions
and
506 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
.../src/main/java/org/apache/drill/exec/physical/base/FileSystemMetadataProviderManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.drill.exec.physical.base; | ||
|
||
import org.apache.drill.exec.planner.common.DrillStatsTable; | ||
import org.apache.drill.exec.record.metadata.schema.SchemaProvider; | ||
import org.apache.drill.exec.store.parquet.ParquetTableMetadataProviderImpl; | ||
|
||
/** | ||
* Implementation of {@link MetadataProviderManager} which uses file system providers and returns | ||
* builders for file system based {@link TableMetadataProvider} instances. | ||
*/ | ||
public class FileSystemMetadataProviderManager implements MetadataProviderManager { | ||
|
||
private SchemaProvider schemaProvider; | ||
private DrillStatsTable statsProvider; | ||
|
||
private TableMetadataProvider tableMetadataProvider; | ||
|
||
public static MetadataProviderManager getMetadataProviderManager() { | ||
return new FileSystemMetadataProviderManager(); | ||
} | ||
|
||
@Override | ||
public void setSchemaProvider(SchemaProvider schemaProvider) { | ||
this.schemaProvider = schemaProvider; | ||
} | ||
|
||
@Override | ||
public void setStatsProvider(DrillStatsTable statsProvider) { | ||
this.statsProvider = statsProvider; | ||
} | ||
|
||
@Override | ||
public DrillStatsTable getStatsProvider() { | ||
return statsProvider; | ||
} | ||
|
||
@Override | ||
public SchemaProvider getSchemaProvider() { | ||
return schemaProvider; | ||
} | ||
|
||
@Override | ||
public void setTableMetadataProvider(TableMetadataProvider tableMetadataProvider) { | ||
this.tableMetadataProvider = tableMetadataProvider; | ||
} | ||
|
||
@Override | ||
public TableMetadataProvider getTableMetadataProvider() { | ||
return tableMetadataProvider; | ||
} | ||
|
||
@Override | ||
public TableMetadataProviderBuilder builder(MetadataProviderKind kind) { | ||
switch (kind) { | ||
case PARQUET_TABLE: | ||
return new ParquetTableMetadataProviderImpl.Builder(this); | ||
case SCHEMA_STATS_ONLY: | ||
return new SimpleFileTableMetadataProvider.Builder(this); | ||
} | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
.../java-exec/src/main/java/org/apache/drill/exec/physical/base/MetadataProviderManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.drill.exec.physical.base; | ||
|
||
import org.apache.drill.exec.planner.common.DrillStatsTable; | ||
import org.apache.drill.exec.record.metadata.schema.SchemaProvider; | ||
|
||
/** | ||
* Base interface for passing and obtaining {@link SchemaProvider}, {@link DrillStatsTable} and | ||
* {@link TableMetadataProvider}, responsible for creating required | ||
* {@link TableMetadataProviderBuilder} which constructs required {@link TableMetadataProvider} | ||
* based on specified providers | ||
*/ | ||
public interface MetadataProviderManager { | ||
|
||
DrillStatsTable getStatsProvider(); | ||
|
||
void setStatsProvider(DrillStatsTable statsProvider); | ||
|
||
SchemaProvider getSchemaProvider(); | ||
|
||
void setSchemaProvider(SchemaProvider schemaProvider); | ||
|
||
TableMetadataProvider getTableMetadataProvider(); | ||
|
||
void setTableMetadataProvider(TableMetadataProvider tableMetadataProvider); | ||
|
||
/** | ||
* Returns builder responsible for constructing required {@link TableMetadataProvider} instances | ||
* based on specified providers. | ||
* | ||
* @param kind kind of {@link TableMetadataProvider} whose builder should be obtained | ||
* @return builder responsible for constructing required {@link TableMetadataProvider} | ||
*/ | ||
TableMetadataProviderBuilder builder(MetadataProviderKind kind); | ||
|
||
/** | ||
* Kinds of {@link TableMetadataProvider} whose builder should be obtained. | ||
*/ | ||
enum MetadataProviderKind { | ||
PARQUET_TABLE, | ||
SCHEMA_STATS_ONLY | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.