Indhumathi27 commented on a change in pull request #3688: [CARBONDATA-3765] 
Refactor Index Metadata for CG and FG Indexes
URL: https://github.com/apache/carbondata/pull/3688#discussion_r405994284
 
 

 ##########
 File path: 
core/src/main/java/org/apache/carbondata/core/datamap/DataMapStoreManager.java
 ##########
 @@ -101,49 +100,29 @@ private DataMapStoreManager() {
   }
 
   /**
-   * It only gives the visible datamaps
-   */
-  List<TableIndex> getAllVisibleIndexes(CarbonTable carbonTable) throws 
IOException {
-    CarbonSessionInfo sessionInfo = 
ThreadLocalSessionInfo.getCarbonSessionInfo();
-    List<TableIndex> allDataMaps = getAllIndexes(carbonTable);
-    Iterator<TableIndex> dataMapIterator = allDataMaps.iterator();
-    while (dataMapIterator.hasNext()) {
-      TableIndex 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;
-  }
-
-  /**
-   * It gives all indexes except the default index.
+   * It gives all indexes except the default index and secondary index.
+   * Collect's Coarse grain and Fine grain indexes on a table
    *
    * @return
    */
   public List<TableIndex> getAllIndexes(CarbonTable carbonTable) throws 
IOException {
-    List<DataMapSchema> dataMapSchemas = getDataMapSchemasOfTable(carbonTable);
+    String indexMeta = 
carbonTable.getTableInfo().getFactTable().getTableProperties()
+        .get(carbonTable.getCarbonTableIdentifier().getTableId());
+    IndexMetadata indexMetadata = IndexMetadata.deserialize(indexMeta);
     List<TableIndex> indexes = new ArrayList<>();
-    if (dataMapSchemas != null) {
-      for (DataMapSchema dataMapSchema : dataMapSchemas) {
-        RelationIdentifier identifier = dataMapSchema.getParentTables().get(0);
-        if (dataMapSchema.isIndex() && identifier.getTableId()
-            .equals(carbonTable.getTableId())) {
-          indexes.add(getIndex(carbonTable, dataMapSchema));
+    if (null != indexMetadata) {
+      // get bloom indexes and lucene indexes
+      for (Map.Entry<String, Map<String, Map<String, String>>> providerEntry : 
indexMetadata
+          .getIndexesMap().entrySet()) {
+        for (Map.Entry<String, Map<String, String>> indexEntry : 
providerEntry.getValue()
+            .entrySet()) {
+          if (!indexEntry.getValue().get(CarbonCommonConstants.INDEX_PROVIDER)
 
 Review comment:
   In CarbonTable, we are adding indexInfo with Provider. In SI Flow, only  
indexes having provider name as "SI" will be sent. Still need to unify the 
flow? If yes, can you please give some inputs

----------------------------------------------------------------
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

Reply via email to