Github user ravipesala commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2176#discussion_r182135807
  
    --- Diff: 
core/src/main/java/org/apache/carbondata/core/datamap/DataMapStoreManager.java 
---
    @@ -111,47 +114,40 @@ private DataMapStoreManager() {
       }
     
       /**
    -   * It gives all datamap schemas.
    +   * It gives all datamap schemas of a given table.
        *
    -   * @return
        */
    -  public List<DataMapSchema> getAllDataMapSchemas(CarbonTable carbonTable) 
{
    -    // TODO cache all schemas and update only when datamap status file 
updates
    -    List<DataMapSchema> dataMapSchemas = getAllDataMapSchemas();
    -    List<DataMapSchema> dataMaps = new ArrayList<>();
    -    if (dataMapSchemas != null) {
    -      for (DataMapSchema dataMapSchema : dataMapSchemas) {
    -        RelationIdentifier identifier = 
dataMapSchema.getParentTables().get(0);
    -        if (dataMapSchema.isIndexDataMap() && identifier.getTableName()
    -            .equals(carbonTable.getTableName()) && 
identifier.getDatabaseName()
    -            .equals(carbonTable.getDatabaseName())) {
    -          dataMaps.add(dataMapSchema);
    -        }
    -      }
    -    }
    -    return dataMaps;
    +  public List<DataMapSchema> getDataMapSchemasOfTable(CarbonTable 
carbonTable) throws IOException {
    +    return provider.retrieveSchemas(carbonTable);
       }
     
    -  public List<DataMapSchema> getAllDataMapSchemas() {
    -    DataMapSchemaStorageProvider provider = new 
DiskBasedDMSchemaStorageProvider(
    -        CarbonProperties.getInstance().getSystemFolderLocation());
    -    List<DataMapSchema> dataMapSchemas;
    -    try {
    -      dataMapSchemas = provider.retrieveAllSchemas();
    -    } catch (IOException e) {
    -      throw new RuntimeException(e);
    -    }
    -    return dataMapSchemas;
    +  /**
    +   * It gives all datamap schemas from store.
    +   */
    +  public List<DataMapSchema> getAllDataMapSchemas() throws IOException {
    +    return provider.retrieveAllSchemas();
       }
     
    -  public DataMapSchema getDataMapSchema(String dataMapName) throws 
NoSuchDataMapException {
    -    List<DataMapSchema> allDataMapSchemas = getAllDataMapSchemas();
    -    for (DataMapSchema dataMapSchema : allDataMapSchemas) {
    -      if (dataMapSchema.getDataMapName().equalsIgnoreCase(dataMapName)) {
    -        return dataMapSchema;
    -      }
    -    }
    -    throw new NoSuchDataMapException(dataMapName);
    +
    +  public DataMapSchema getDataMapSchema(String dataMapName)
    +      throws NoSuchDataMapException, IOException {
    +    return provider.retrieveSchema(dataMapName);
    +  }
    +
    +  /**
    +   * Saves the datamap schema to storage
    +   * @param dataMapSchema
    +   */
    +  public void saveDataMapSchema(DataMapSchema dataMapSchema) throws 
IOException {
    +    provider.saveSchema(dataMapSchema);
    +  }
    +
    +  /**
    +   * Saves the datamap schema to storage
    --- End diff --
    
    ok


---

Reply via email to