Search in sources :

Example 36 with DatasetProperties

use of co.cask.cdap.api.dataset.DatasetProperties in project cdap by caskdata.

the class CubeDatasetDefinition method reconfigure.

@Override
public DatasetSpecification reconfigure(String instanceName, DatasetProperties newProps, DatasetSpecification currentSpec) throws IncompatibleUpdateException {
    DatasetProperties factTableProperties = computeFactTableProperties(newProps);
    List<DatasetSpecification> datasetSpecs = Lists.newArrayList();
    // Configuring table that hold mappings of tag names and values and such
    datasetSpecs.add(reconfigure(metricsTableDef, "entity", newProps, currentSpec.getSpecification("entity")));
    for (int resolution : getResolutions(newProps.getProperties())) {
        String factTableName = String.valueOf(resolution);
        DatasetSpecification existing = currentSpec.getSpecification(factTableName);
        DatasetSpecification factTableSpec = existing == null ? tableDef.configure(factTableName, factTableProperties) : reconfigure(tableDef, factTableName, factTableProperties, existing);
        datasetSpecs.add(factTableSpec);
    }
    return DatasetSpecification.builder(instanceName, getName()).properties(newProps.getProperties()).datasets(datasetSpecs).build();
}
Also used : DatasetProperties(co.cask.cdap.api.dataset.DatasetProperties) DatasetSpecification(co.cask.cdap.api.dataset.DatasetSpecification)

Example 37 with DatasetProperties

use of co.cask.cdap.api.dataset.DatasetProperties in project cdap by caskdata.

the class AppWithCube method configure.

@Override
public void configure() {
    DatasetProperties props = DatasetProperties.builder().add("dataset.cube.resolutions", "1,60").add("dataset.cube.aggregation.agg1.dimensions", "user,action").add("dataset.cube.aggregation.agg1.requiredDimensions", "user,action").build();
    createDataset(CUBE_NAME, Cube.class, props);
    addService(SERVICE_NAME, new CubeHandler());
}
Also used : DatasetProperties(co.cask.cdap.api.dataset.DatasetProperties)

Example 38 with DatasetProperties

use of co.cask.cdap.api.dataset.DatasetProperties in project cdap by caskdata.

the class HBaseMetricsTableTest method getTable.

@Override
protected MetricsTable getTable(String name) throws Exception {
    // add v3 so that all the tests are performed for v3 table
    DatasetId metricsDatasetInstanceId = getDatasetId(name);
    DatasetProperties props = TableProperties.builder().setReadlessIncrementSupport(true).build();
    return DatasetsUtil.getOrCreateDataset(dsFramework, metricsDatasetInstanceId, MetricsTable.class.getName(), props, null);
}
Also used : MetricsTable(co.cask.cdap.data2.dataset2.lib.table.MetricsTable) DatasetProperties(co.cask.cdap.api.dataset.DatasetProperties) DatasetId(co.cask.cdap.proto.id.DatasetId)

Aggregations

DatasetProperties (co.cask.cdap.api.dataset.DatasetProperties)38 DatasetSpecification (co.cask.cdap.api.dataset.DatasetSpecification)17 Test (org.junit.Test)12 Transaction (org.apache.tephra.Transaction)11 DatasetId (co.cask.cdap.proto.id.DatasetId)10 IncompatibleUpdateException (co.cask.cdap.api.dataset.IncompatibleUpdateException)9 DatasetAdmin (co.cask.cdap.api.dataset.DatasetAdmin)8 Table (co.cask.cdap.api.dataset.table.Table)7 BufferingTableTest (co.cask.cdap.data2.dataset2.lib.table.BufferingTableTest)6 TransactionAware (org.apache.tephra.TransactionAware)6 HBaseTable (co.cask.cdap.data2.dataset2.lib.table.hbase.HBaseTable)5 DatasetTypeMeta (co.cask.cdap.proto.DatasetTypeMeta)5 IOException (java.io.IOException)5 DatasetManagementException (co.cask.cdap.api.dataset.DatasetManagementException)4 Reconfigurable (co.cask.cdap.api.dataset.Reconfigurable)4 Get (co.cask.cdap.api.dataset.table.Get)4 Scan (co.cask.cdap.api.dataset.table.Scan)4 Scanner (co.cask.cdap.api.dataset.table.Scanner)4 DetachedTxSystemClient (org.apache.tephra.inmemory.DetachedTxSystemClient)4 BadRequestException (co.cask.cdap.common.BadRequestException)3