/** * Get all datamaps of the table for clearing purpose */ public DataMapExprWrapper getAllDataMapsForClear(CarbonTable carbonTable) throws IOException { List<TableDataMap> allDataMapFG = DataMapStoreManager.getInstance().getAllDataMap(carbonTable); DataMapExprWrapper initialExpr = null; if (allDataMapFG.size() > 0) { initialExpr = new DataMapExprWrapperImpl(allDataMapFG.get(0), null); for (int i = 1; i < allDataMapFG.size(); i++) { initialExpr = new AndDataMapExprWrapper(initialExpr, new DataMapExprWrapperImpl(allDataMapFG.get(i), null), null); } } return initialExpr; }
/** * Clear the invalid segments from all the datamaps of the table * @param carbonTable * @param segments */ public void clearInvalidSegments(CarbonTable carbonTable, List<Segment> segments) throws IOException { getDefaultDataMap(carbonTable).clear(segments); List<TableDataMap> allDataMap = getAllDataMap(carbonTable); for (TableDataMap dataMap: allDataMap) { dataMap.clear(segments); } }
/** * It only gives the visible datamaps */ List<TableDataMap> getAllVisibleDataMap(CarbonTable carbonTable) throws IOException { CarbonSessionInfo sessionInfo = ThreadLocalSessionInfo.getCarbonSessionInfo(); List<TableDataMap> allDataMaps = getAllDataMap(carbonTable); Iterator<TableDataMap> dataMapIterator = allDataMaps.iterator(); while (dataMapIterator.hasNext()) { TableDataMap dataMap = dataMapIterator.next(); String dbName = carbonTable.getDatabaseName(); String tableName = carbonTable.getTableName(); String dmName = dataMap.getDataMapSchema().getDataMapName(); // TODO: need support get the visible status of datamap without sessionInfo in the future if (sessionInfo != null) { boolean isDmVisible = sessionInfo.getSessionParams().getProperty( String.format("%s%s.%s.%s", CarbonCommonConstants.CARBON_DATAMAP_VISIBLE, dbName, tableName, dmName), "true").trim().equalsIgnoreCase("true"); if (!isDmVisible) { LOGGER.warn(String.format("Ignore invisible datamap %s on table %s.%s", dmName, dbName, tableName)); dataMapIterator.remove(); } } else { String message = "Carbon session info is null"; LOGGER.info(message); } } return allDataMaps; }
dataMaps = DataMapStoreManager.getInstance().getAllDataMap(getCarbonTable()); } catch (IOException ex) { LOGGER.error("failed to get datamaps");
List<TableDataMap> datamaps = DataMapStoreManager.getInstance().getAllDataMap(carbonTable); if (!datamaps.isEmpty()) { for (TableDataMap dataMap : datamaps) {
/** * register all datamap writer for specified table and segment */ public void registerAllWriter(CarbonTable carbonTable, String segmentId, String taskNo, SegmentProperties segmentProperties) { // clear cache in executor side DataMapStoreManager.getInstance() .clearDataMaps(carbonTable.getCarbonTableIdentifier().getTableUniqueName()); List<TableDataMap> tableIndices; try { tableIndices = DataMapStoreManager.getInstance().getAllDataMap(carbonTable); } catch (IOException e) { LOG.error("Error while retrieving datamaps", e); throw new RuntimeException(e); } if (tableIndices != null) { tblIdentifier = carbonTable.getCarbonTableIdentifier(); for (TableDataMap tableDataMap : tableIndices) { // register it only if it is not lazy datamap, for lazy datamap, user // will rebuild the datamap manually if (!tableDataMap.getDataMapSchema().isLazy()) { DataMapFactory factory = tableDataMap.getDataMapFactory(); register(factory, segmentId, taskNo, segmentProperties); } } } }
List<Segment> invalidSegments = validAndInvalidSegmentsInfo.getInvalidSegments(); DataMapExprWrapper dataMapExprWrapper = null; if (DataMapStoreManager.getInstance().getAllDataMap(carbonTable).size() > 0) { DataMapChooser dataMapChooser = new DataMapChooser(carbonTable); dataMapExprWrapper = dataMapChooser.getAllDataMapsForClear(carbonTable);
List<TableDataMap> indexDataMaps = new ArrayList<>(); try { for (TableDataMap dataMap : DataMapStoreManager.getInstance().getAllDataMap(carbonTable)) { if (dataMap.getDataMapSchema().isIndexDataMap()) { indexDataMaps.add(dataMap);