/** * Method to clear the data maps */ public void clearDataMaps() throws IOException { DataMapStoreManager.getInstance().clearDataMaps(absoluteTableIdentifier); }
/** * Clear the datamap/datamaps of a table from memory * * @param identifier Table identifier */ public void clearDataMaps(AbsoluteTableIdentifier identifier) { CarbonTable carbonTable = getCarbonTable(identifier); String tableUniqueName = identifier.getCarbonTableIdentifier().getTableUniqueName(); List<TableDataMap> tableIndices = allDataMaps.get(tableUniqueName); if (tableIndices == null) { String keyUsingTablePath = getKeyUsingTablePath(identifier.getTablePath()); if (keyUsingTablePath != null) { tableUniqueName = keyUsingTablePath; tableIndices = allDataMaps.get(tableUniqueName); } } if (null != carbonTable && tableIndices != null) { try { DataMapUtil.executeDataMapJobForClearingDataMaps(carbonTable); } catch (IOException e) { LOGGER.error("clear dataMap job failed", e); // ignoring the exception } } segmentRefreshMap.remove(identifier.uniqueName()); clearDataMaps(tableUniqueName); allDataMaps.remove(tableUniqueName); tablePathMap.remove(tableUniqueName); }
@Override public void close() throws IOException { logStatistics(rowCount, queryModel.getStatisticsRecorder()); // clear dictionary cache Map<String, Dictionary> columnToDictionaryMapping = queryModel.getColumnToDictionaryMapping(); if (null != columnToDictionaryMapping) { for (Map.Entry<String, Dictionary> entry : columnToDictionaryMapping.entrySet()) { CarbonUtil.clearDictionaryCache(entry.getValue()); } } if (!skipClearDataMapAtClose) { // Clear the datamap cache DataMapStoreManager.getInstance().clearDataMaps( queryModel.getTable().getAbsoluteTableIdentifier()); } // close read support readSupport.close(); carbonIterator.close(); try { queryExecutor.finish(); } catch (QueryExecutionException e) { throw new IOException(e); } }
/** * 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); } } } }
.clearDataMaps(table.getAbsoluteTableIdentifier()); throw ex;
@Override public void initialize(InputSplit inputSplit, TaskAttemptContext taskAttemptContext) throws IOException, InterruptedException { distributable = (DataMapDistributableWrapper) inputSplit; // clear the segmentMap and from cache in executor when there are invalid segments if (invalidSegments.size() > 0) { DataMapStoreManager.getInstance().clearInvalidSegments(table, invalidSegments); } TableDataMap tableDataMap = DataMapStoreManager.getInstance() .getDataMap(table, distributable.getDistributable().getDataMapSchema()); if (isJobToClearDataMaps) { // if job is to clear datamaps just clear datamaps from cache and return DataMapStoreManager.getInstance() .clearDataMaps(table.getCarbonTableIdentifier().getTableUniqueName()); // clear the segment properties cache from executor SegmentPropertiesAndSchemaHolder.getInstance() .invalidate(table.getAbsoluteTableIdentifier()); blockletIterator = Collections.emptyIterator(); return; } dataMaps = tableDataMap.getTableDataMaps(distributable.getDistributable()); List<ExtendedBlocklet> blocklets = tableDataMap .prune(dataMaps, distributable.getDistributable(), dataMapExprWrapper.getFilterResolverIntf(distributable.getUniqueId()), partitions); for (ExtendedBlocklet blocklet : blocklets) { blocklet.setDataMapUniqueId(distributable.getUniqueId()); } blockletIterator = blocklets.iterator(); }