niuge01 commented on a change in pull request #3661: [CARBONDATA-3704] Support create materialized view on all type table, and make mv support mutil-tenant. URL: https://github.com/apache/carbondata/pull/3661#discussion_r400681805
########## File path: core/src/main/java/org/apache/carbondata/core/datamap/IndexChooser.java ########## @@ -59,76 +59,76 @@ * the datamap which has fewer columns that is the first datamap. */ @InterfaceAudience.Internal -public class DataMapChooser { +public class IndexChooser { private CarbonTable carbonTable; - private List<TableDataMap> cgDataMaps; - private List<TableDataMap> fgDataMaps; + private List<TableIndex> cgIndexes; + private List<TableIndex> fgIndexes; - public DataMapChooser(CarbonTable carbonTable) throws IOException { + public IndexChooser(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); + // read all indexes for this table and populate CG and FG index list + List<TableIndex> visibleIndexes = + DataMapStoreManager.getInstance().getAllVisibleIndexes(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()); + cgIndexes = new ArrayList<>(visibleIndexes.size()); + fgIndexes = new ArrayList<>(visibleIndexes.size()); + for (TableIndex visibleIndex : visibleIndexes) { + DataMapStatusDetail status = map.get(visibleIndex.getDataMapSchema().getDataMapName()); if (status != null && status.isEnabled()) { - DataMapLevel level = visibleDataMap.getDataMapFactory().getDataMapLevel(); - if (level == DataMapLevel.CG) { - cgDataMaps.add(visibleDataMap); + IndexLevel level = visibleIndex.getIndexFactory().getDataMapLevel(); + if (level == IndexLevel.CG) { + cgIndexes.add(visibleIndex); } else { - fgDataMaps.add(visibleDataMap); + fgIndexes.add(visibleIndex); } } } } /** - * Return a chosen datamap based on input filter. See {@link DataMapChooser} + * Return a chosen datamap based on input filter. See {@link IndexChooser} */ - public DataMapExprWrapper choose(FilterResolverIntf filter) { + public IndexExprWrapper choose(FilterResolverIntf filter) { if (filter != null) { Expression expression = filter.getFilterExpression(); // First check for FG datamaps if any exist - ExpressionTuple tuple = selectDataMap(expression, fgDataMaps, filter); - if (tuple.dataMapExprWrapper == null) { + ExpressionTuple tuple = selectDataMap(expression, fgIndexes, filter); + if (tuple.indexExprWrapper == null) { // Check for CG datamap - tuple = selectDataMap(expression, cgDataMaps, filter); + tuple = selectDataMap(expression, cgIndexes, filter); } - if (tuple.dataMapExprWrapper != null) { - return tuple.dataMapExprWrapper; + if (tuple.indexExprWrapper != null) { + return tuple.indexExprWrapper; } } // Return the default datamap if no other datamap exists. - return new DataMapExprWrapperImpl( - DataMapStoreManager.getInstance().getDefaultDataMap(carbonTable), filter); + return new IndexExprWrapperImpl( + DataMapStoreManager.getInstance().getDefaultIndex(carbonTable), filter); } /** - * Return a chosen FG datamap based on input filter. See {@link DataMapChooser} + * Return a chosen FG datamap based on input filter. See {@link IndexChooser} */ - public DataMapExprWrapper chooseFGDataMap(FilterResolverIntf resolverIntf) { - return chooseDataMap(DataMapLevel.FG, resolverIntf); + public IndexExprWrapper chooseFGDataMap(FilterResolverIntf resolverIntf) { + return chooseDataMap(IndexLevel.FG, resolverIntf); } /** - * Return a chosen CG datamap based on input filter. See {@link DataMapChooser} + * Return a chosen CG datamap based on input filter. See {@link IndexChooser} */ - public DataMapExprWrapper chooseCGDataMap(FilterResolverIntf resolverIntf) { - return chooseDataMap(DataMapLevel.CG, resolverIntf); + public IndexExprWrapper chooseCGDataMap(FilterResolverIntf resolverIntf) { + return chooseDataMap(IndexLevel.CG, resolverIntf); } - DataMapExprWrapper chooseDataMap(DataMapLevel level, FilterResolverIntf resolverIntf) { + IndexExprWrapper chooseDataMap(IndexLevel level, FilterResolverIntf resolverIntf) { if (resolverIntf != null) { Expression expression = resolverIntf.getFilterExpression(); - List<TableDataMap> datamaps = level == DataMapLevel.CG ? cgDataMaps : fgDataMaps; + List<TableIndex> datamaps = level == IndexLevel.CG ? cgIndexes : fgIndexes; Review comment: Yes, we will do it in a new pr. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services