Search in sources :

Example 1 with TableProperties

use of com.mapr.fs.tables.TableProperties in project drill by axbaretto.

the class MapRDBFormatPlugin method getGroupScan.

@Override
public AbstractGroupScan getGroupScan(String userName, FileSelection selection, List<SchemaPath> columns) throws IOException {
    String tableName = getTableName(selection);
    TableProperties props = getMaprFS().getTableProperties(new Path(tableName));
    if (props.getAttr().getJson()) {
        JsonScanSpec scanSpec = new JsonScanSpec(tableName, null);
        return new JsonTableGroupScan(userName, getStoragePlugin(), this, scanSpec, columns);
    } else {
        HBaseScanSpec scanSpec = new HBaseScanSpec(tableName);
        return new BinaryTableGroupScan(userName, getStoragePlugin(), this, scanSpec, columns);
    }
}
Also used : SchemaPath(org.apache.drill.common.expression.SchemaPath) Path(org.apache.hadoop.fs.Path) HBaseScanSpec(org.apache.drill.exec.store.hbase.HBaseScanSpec) JsonTableGroupScan(org.apache.drill.exec.store.mapr.db.json.JsonTableGroupScan) JsonScanSpec(org.apache.drill.exec.store.mapr.db.json.JsonScanSpec) TableProperties(com.mapr.fs.tables.TableProperties) BinaryTableGroupScan(org.apache.drill.exec.store.mapr.db.binary.BinaryTableGroupScan)

Example 2 with TableProperties

use of com.mapr.fs.tables.TableProperties 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 3 with TableProperties

use of com.mapr.fs.tables.TableProperties in project drill by apache.

the class MapRDBFormatPlugin method getGroupScan.

@Override
public AbstractGroupScan getGroupScan(String userName, FileSelection selection, List<SchemaPath> columns) throws IOException {
    List<String> files = selection.getFiles();
    assert (files.size() == 1);
    String tableName = files.get(0);
    TableProperties props = getMaprFS().getTableProperties(new Path(tableName));
    if (props.getAttr().getJson()) {
        JsonScanSpec scanSpec = new JsonScanSpec(tableName, null);
        return new JsonTableGroupScan(userName, getStoragePlugin(), this, scanSpec, columns);
    } else {
        HBaseScanSpec scanSpec = new HBaseScanSpec(tableName);
        return new BinaryTableGroupScan(userName, getStoragePlugin(), this, scanSpec, columns);
    }
}
Also used : SchemaPath(org.apache.drill.common.expression.SchemaPath) Path(org.apache.hadoop.fs.Path) HBaseScanSpec(org.apache.drill.exec.store.hbase.HBaseScanSpec) JsonTableGroupScan(org.apache.drill.exec.store.mapr.db.json.JsonTableGroupScan) JsonScanSpec(org.apache.drill.exec.store.mapr.db.json.JsonScanSpec) TableProperties(com.mapr.fs.tables.TableProperties) BinaryTableGroupScan(org.apache.drill.exec.store.mapr.db.binary.BinaryTableGroupScan)

Example 4 with TableProperties

use of com.mapr.fs.tables.TableProperties 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)

Example 5 with TableProperties

use of com.mapr.fs.tables.TableProperties in project drill by apache.

the class MapRDBFormatPlugin method getGroupScan.

public AbstractGroupScan getGroupScan(String userName, FileSelection selection, List<SchemaPath> columns, IndexDesc indexDesc, MetadataProviderManager metadataProviderManager) throws IOException {
    String tableName = getTableName(selection);
    TableProperties props = getMaprFS().getTableProperties(new Path(tableName));
    if (props.getAttr().getJson()) {
        JsonScanSpec scanSpec = new JsonScanSpec(tableName, indexDesc, null);
        return new JsonTableGroupScan(userName, getStoragePlugin(), this, scanSpec, columns, metadataProviderManager);
    } else {
        HBaseScanSpec scanSpec = new HBaseScanSpec(tableName);
        return new BinaryTableGroupScan(userName, getStoragePlugin(), this, scanSpec, columns, metadataProviderManager);
    }
}
Also used : Path(org.apache.hadoop.fs.Path) SchemaPath(org.apache.drill.common.expression.SchemaPath) HBaseScanSpec(org.apache.drill.exec.store.hbase.HBaseScanSpec) JsonTableGroupScan(org.apache.drill.exec.store.mapr.db.json.JsonTableGroupScan) JsonScanSpec(org.apache.drill.exec.store.mapr.db.json.JsonScanSpec) TableProperties(com.mapr.fs.tables.TableProperties) BinaryTableGroupScan(org.apache.drill.exec.store.mapr.db.binary.BinaryTableGroupScan)

Aggregations

TableProperties (com.mapr.fs.tables.TableProperties)5 Path (org.apache.hadoop.fs.Path)5 SchemaPath (org.apache.drill.common.expression.SchemaPath)3 HBaseScanSpec (org.apache.drill.exec.store.hbase.HBaseScanSpec)3 BinaryTableGroupScan (org.apache.drill.exec.store.mapr.db.binary.BinaryTableGroupScan)3 JsonScanSpec (org.apache.drill.exec.store.mapr.db.json.JsonScanSpec)3 JsonTableGroupScan (org.apache.drill.exec.store.mapr.db.json.JsonTableGroupScan)3 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