use of org.apache.carbondata.core.metadata.schema.table.DataMapSchema in project carbondata by apache.
the class DataMapStoreManager method getAllDataMap.
/**
* It gives all datamaps except the default datamap.
*
* @return
*/
public List<TableDataMap> getAllDataMap(CarbonTable carbonTable) {
// TODO cache all schemas and update only when datamap status file updates
List<DataMapSchema> dataMapSchemas = getAllDataMapSchemas();
List<TableDataMap> dataMaps = new ArrayList<>();
if (dataMapSchemas != null) {
for (DataMapSchema dataMapSchema : dataMapSchemas) {
RelationIdentifier identifier = dataMapSchema.getParentTables().get(0);
if (dataMapSchema.isIndexDataMap() && identifier.getTableName().equals(carbonTable.getTableName()) && identifier.getDatabaseName().equals(carbonTable.getDatabaseName())) {
dataMaps.add(getDataMap(carbonTable, dataMapSchema));
}
}
}
return dataMaps;
}
use of org.apache.carbondata.core.metadata.schema.table.DataMapSchema in project carbondata by apache.
the class DataMapStatusManager method enableDataMap.
public static void enableDataMap(String dataMapName) throws IOException {
DataMapSchema dataMapSchema = validateDataMap(dataMapName, false);
List<DataMapSchema> list = new ArrayList<>();
if (dataMapSchema != null) {
list.add(dataMapSchema);
}
storageProvider.updateDataMapStatus(list, DataMapStatus.ENABLED);
}
use of org.apache.carbondata.core.metadata.schema.table.DataMapSchema in project carbondata by apache.
the class DataMapStatusManager method validateDataMap.
private static DataMapSchema validateDataMap(String dataMapName, boolean valdate) {
List<DataMapSchema> allDataMapSchemas = DataMapStoreManager.getInstance().getAllDataMapSchemas();
DataMapSchema dataMapSchema = null;
for (DataMapSchema schema : allDataMapSchemas) {
if (schema.getDataMapName().equalsIgnoreCase(dataMapName)) {
dataMapSchema = schema;
}
}
if (dataMapSchema == null && valdate) {
throw new UnsupportedOperationException("Cannot be disabled non exist datamap");
} else {
return dataMapSchema;
}
}
use of org.apache.carbondata.core.metadata.schema.table.DataMapSchema in project carbondata by apache.
the class DataMapStatusManager method disableDataMap.
public static void disableDataMap(String dataMapName) throws Exception {
DataMapSchema dataMapSchema = validateDataMap(dataMapName, false);
List<DataMapSchema> list = new ArrayList<>();
if (dataMapSchema != null) {
list.add(dataMapSchema);
}
storageProvider.updateDataMapStatus(list, DataMapStatus.DISABLED);
}
use of org.apache.carbondata.core.metadata.schema.table.DataMapSchema in project carbondata by apache.
the class ThriftWrapperSchemaConverterImpl method fromExternalToWrapperDataMapSchema.
@Override
public DataMapSchema fromExternalToWrapperDataMapSchema(org.apache.carbondata.format.DataMapSchema thriftDataMapSchema) {
DataMapSchema childSchema = new DataMapSchema(thriftDataMapSchema.getDataMapName(), thriftDataMapSchema.getClassName());
childSchema.setProperties(thriftDataMapSchema.getProperties());
if (null != thriftDataMapSchema.getChildTableIdentifier()) {
RelationIdentifier relationIdentifier = new RelationIdentifier(thriftDataMapSchema.getChildTableIdentifier().getDatabaseName(), thriftDataMapSchema.getChildTableIdentifier().getTableName(), thriftDataMapSchema.getChildTableIdentifier().getTableId());
childSchema.setRelationIdentifier(relationIdentifier);
childSchema.setChildSchema(fromExternalToWrapperTableSchema(thriftDataMapSchema.getChildTableSchema(), relationIdentifier.getTableName()));
}
return childSchema;
}
Aggregations