/** * This method will disable all lazy (DEFERRED REBUILD) datamap in the given table */ public static void disableAllLazyDataMaps(CarbonTable table) throws IOException { List<DataMapSchema> allDataMapSchemas = DataMapStoreManager.getInstance().getDataMapSchemasOfTable(table); List<DataMapSchema> dataMapToBeDisabled = new ArrayList<>(allDataMapSchemas.size()); for (DataMapSchema dataMap : allDataMapSchemas) { // TODO all non datamaps like MV is now supports only lazy. Once the support is made the // following check can be removed. if (dataMap.isLazy() || !dataMap.isIndexDataMap()) { dataMapToBeDisabled.add(dataMap); } } storageProvider.updateDataMapStatus(dataMapToBeDisabled, DataMapStatus.DISABLED); }
/** * Return true if MV datamap present in the specified table * @param carbonTable * @return timeseries data map present */ public static boolean hasMVDataMap(CarbonTable carbonTable) throws IOException { List<DataMapSchema> dataMapSchemaList = DataMapStoreManager.getInstance() .getDataMapSchemasOfTable(carbonTable); for (DataMapSchema dataMapSchema : dataMapSchemaList) { if (dataMapSchema.getProviderName().equalsIgnoreCase(MV.toString())) { return true; } } return false; }
/** * It gives all datamaps except the default datamap. * * @return */ public List<TableDataMap> getAllDataMap(CarbonTable carbonTable) throws IOException { List<DataMapSchema> dataMapSchemas = getDataMapSchemasOfTable(carbonTable); List<TableDataMap> dataMaps = new ArrayList<>(); if (dataMapSchemas != null) { for (DataMapSchema dataMapSchema : dataMapSchemas) { RelationIdentifier identifier = dataMapSchema.getParentTables().get(0); if (dataMapSchema.isIndexDataMap() && identifier.getTableId() .equals(carbonTable.getTableId())) { dataMaps.add(getDataMap(carbonTable, dataMapSchema)); } } } return dataMaps; }