use of io.cdap.cdap.spi.data.common.MetricStructuredTable in project cdap by caskdata.
the class NoSqlStructuredTableContext method getTable.
@Override
public StructuredTable getTable(StructuredTableId tableId) throws StructuredTableInstantiationException, TableNotFoundException {
try {
StructuredTableSchema schema = tableAdmin.getSchema(tableId);
Map<String, String> arguments = new HashMap<>();
if (schema.getIndexes().isEmpty()) {
// No indexes on the table
arguments.put(IndexedTable.INDEX_COLUMNS_CONF_KEY, "");
arguments.put(IndexedTable.DYNAMIC_INDEXING_PREFIX, "");
} else {
arguments.put(IndexedTable.INDEX_COLUMNS_CONF_KEY, Joiner.on(",").join(schema.getIndexes()));
arguments.put(IndexedTable.DYNAMIC_INDEXING_PREFIX, tableId.getName());
}
StructuredTable table = new NoSqlStructuredTable(datasetContext.getDataset(NoSqlStructuredTableAdmin.ENTITY_TABLE_NAME, arguments), schema);
return new MetricStructuredTable(tableId, table, metricsCollector, emitTimeMetrics);
} catch (DatasetInstantiationException e) {
throw new StructuredTableInstantiationException(tableId, String.format("Error instantiating table %s", tableId), e);
}
}
Aggregations