/** * Get the blocklet datamap factory to get the detail information of blocklets * * @param table * @return */ private BlockletDetailsFetcher getBlockletDetailsFetcher(CarbonTable table) { TableDataMap blockletMap = getDataMap(table, BlockletDataMapFactory.DATA_MAP_SCHEMA); return (BlockletDetailsFetcher) blockletMap.getDataMapFactory(); }
@Override public DataMapLevel getDataMapLevel() { return dataMap.getDataMapFactory().getDataMapLevel(); }
private TableDataMap chooseDataMap(List<TableDataMap> allDataMap, List<ColumnExpression> columnExpressions, Set<ExpressionType> expressionTypes) { List<DataMapTuple> tuples = new ArrayList<>(); for (TableDataMap dataMap : allDataMap) { if (null != dataMap.getDataMapFactory().getMeta() && contains( dataMap.getDataMapFactory().getMeta(), columnExpressions, expressionTypes)) { tuples.add( new DataMapTuple(dataMap.getDataMapFactory().getMeta().getIndexedColumns().size(), dataMap)); } } if (tuples.size() > 0) { Collections.sort(tuples); return tuples.get(0).dataMap; } return null; }
public DataMapChooser(CarbonTable carbonTable) throws IOException { this.carbonTable = carbonTable; // read all datamaps for this table and populate CG and FG datamap list List<TableDataMap> visibleDataMaps = DataMapStoreManager.getInstance().getAllVisibleDataMap(carbonTable); Map<String, DataMapStatusDetail> map = DataMapStatusManager.readDataMapStatusMap(); cgDataMaps = new ArrayList<>(visibleDataMaps.size()); fgDataMaps = new ArrayList<>(visibleDataMaps.size()); for (TableDataMap visibleDataMap : visibleDataMaps) { DataMapStatusDetail status = map.get(visibleDataMap.getDataMapSchema().getDataMapName()); if (status != null && status.isEnabled()) { DataMapLevel level = visibleDataMap.getDataMapFactory().getDataMapLevel(); if (level == DataMapLevel.CG) { cgDataMaps.add(visibleDataMap); } else { fgDataMaps.add(visibleDataMap); } } } }
dataMap.getDataMapFactory().setCarbonTable(table); return dataMap;
/** * 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); } } } }