use of org.apache.drill.exec.store.dfs.FormatPlugin in project drill by apache.
the class DrillStatsTable method readStatistics.
private TableStatistics readStatistics(DrillTable drillTable, Path path) throws IOException {
final Object selection = drillTable.getSelection();
if (selection instanceof FormatSelection) {
StoragePlugin storagePlugin = drillTable.getPlugin();
FormatSelection formatSelection = (FormatSelection) selection;
FormatPluginConfig formatConfig = formatSelection.getFormat();
if (storagePlugin instanceof FileSystemPlugin && (formatConfig instanceof ParquetFormatConfig)) {
FormatPlugin fmtPlugin = storagePlugin.getFormatPlugin(formatConfig);
if (fmtPlugin.supportsStatistics()) {
return fmtPlugin.readStatistics(fs, path);
}
}
}
return null;
}
use of org.apache.drill.exec.store.dfs.FormatPlugin in project drill by apache.
the class HiveStoragePlugin method getFormatPlugin.
@Override
public FormatPlugin getFormatPlugin(FormatPluginConfig formatConfig) {
// TODO: implement formatCreator similar to FileSystemPlugin formatCreator. DRILL-6621
try {
Class<?> mapRDBFormatPluginConfigClass = Class.forName("org.apache.drill.exec.store.mapr.db.MapRDBFormatPluginConfig");
Class<?> mapRDBFormatPluginClass = Class.forName("org.apache.drill.exec.store.mapr.db.MapRDBFormatPlugin");
if (mapRDBFormatPluginConfigClass.isInstance(formatConfig)) {
return (FormatPlugin) mapRDBFormatPluginClass.getConstructor(new Class[] { String.class, DrillbitContext.class, Configuration.class, StoragePluginConfig.class, mapRDBFormatPluginConfigClass }).newInstance(new Object[] { HIVE_MAPRDB_FORMAT_PLUGIN_NAME, context, hiveConf, config, formatConfig });
}
} catch (ReflectiveOperationException e) {
throw new DrillRuntimeException("The error is occurred while connecting to MapR-DB or instantiating mapRDBFormatPlugin", e);
}
throw new DrillRuntimeException(String.format("Hive storage plugin doesn't support usage of %s format plugin", formatConfig.getClass().getName()));
}
Aggregations