Search in sources :

Example 1 with MapRDBBinaryTable

use of org.apache.drill.exec.store.mapr.db.binary.MapRDBBinaryTable in project drill by apache.

the class MapRDBFormatMatcher method isReadable.

@Override
public DrillTable isReadable(DrillFileSystem fs, FileSelection selection, FileSystemPlugin fsPlugin, String storageEngineName, SchemaConfig schemaConfig) throws IOException {
    if (isFileReadable(fs, selection.getFirstPath(fs))) {
        MapRDBFormatPlugin mapRDBFormatPlugin = (MapRDBFormatPlugin) getFormatPlugin();
        String tableName = mapRDBFormatPlugin.getTableName(selection);
        TableProperties props = mapRDBFormatPlugin.getMaprFS().getTableProperties(new Path(tableName));
        if (props.getAttr().getJson()) {
            return new DynamicDrillTable(fsPlugin, storageEngineName, schemaConfig.getUserName(), new FormatSelection(mapRDBFormatPlugin.getConfig(), selection));
        } else {
            FormatSelection formatSelection = new FormatSelection(mapRDBFormatPlugin.getConfig(), selection);
            return new MapRDBBinaryTable(storageEngineName, fsPlugin, mapRDBFormatPlugin, formatSelection);
        }
    }
    return null;
}
Also used : Path(org.apache.hadoop.fs.Path) MapRDBBinaryTable(org.apache.drill.exec.store.mapr.db.binary.MapRDBBinaryTable) DynamicDrillTable(org.apache.drill.exec.planner.logical.DynamicDrillTable) FormatSelection(org.apache.drill.exec.store.dfs.FormatSelection) TableProperties(com.mapr.fs.tables.TableProperties)

Example 2 with MapRDBBinaryTable

use of org.apache.drill.exec.store.mapr.db.binary.MapRDBBinaryTable in project drill by axbaretto.

the class MapRDBFormatMatcher method isReadable.

@Override
public DrillTable isReadable(DrillFileSystem fs, FileSelection selection, FileSystemPlugin fsPlugin, String storageEngineName, SchemaConfig schemaConfig) throws IOException {
    if (isFileReadable(fs, selection.getFirstPath(fs))) {
        List<String> files = selection.getFiles();
        assert (files.size() == 1);
        String tableName = files.get(0);
        TableProperties props = getFormatPlugin().getMaprFS().getTableProperties(new Path(tableName));
        if (props.getAttr().getJson()) {
            return new DynamicDrillTable(fsPlugin, storageEngineName, schemaConfig.getUserName(), new FormatSelection(getFormatPlugin().getConfig(), selection));
        } else {
            FormatSelection formatSelection = new FormatSelection(getFormatPlugin().getConfig(), selection);
            return new MapRDBBinaryTable(storageEngineName, fsPlugin, (MapRDBFormatPlugin) getFormatPlugin(), formatSelection);
        }
    }
    return null;
}
Also used : Path(org.apache.hadoop.fs.Path) MapRDBBinaryTable(org.apache.drill.exec.store.mapr.db.binary.MapRDBBinaryTable) DynamicDrillTable(org.apache.drill.exec.planner.logical.DynamicDrillTable) FormatSelection(org.apache.drill.exec.store.dfs.FormatSelection) TableProperties(com.mapr.fs.tables.TableProperties)

Aggregations

TableProperties (com.mapr.fs.tables.TableProperties)2 DynamicDrillTable (org.apache.drill.exec.planner.logical.DynamicDrillTable)2 FormatSelection (org.apache.drill.exec.store.dfs.FormatSelection)2 MapRDBBinaryTable (org.apache.drill.exec.store.mapr.db.binary.MapRDBBinaryTable)2 Path (org.apache.hadoop.fs.Path)2