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

    https://github.com/apache/carbondata/pull/1987#discussion_r170206534
  
    --- Diff: 
core/src/main/java/org/apache/carbondata/core/datamap/DataMapStoreManager.java 
---
    @@ -142,46 +142,45 @@ public TableDataMap 
getDataMap(AbsoluteTableIdentifier identifier, DataMapSchema
        * The datamap is created using datamap name, datamap factory class and 
table identifier.
        */
       public TableDataMap createAndRegisterDataMap(AbsoluteTableIdentifier 
identifier,
    -      DataMapSchema dataMapSchema)
    -      throws MalformedDataMapCommandException {
    +      DataMapSchema dataMapSchema) throws MalformedDataMapCommandException 
{
    +    IndexDataMapFactory indexDataMapFactory;
    +    try {
    +      // try to create datamap by reflection to test whether it is a valid 
IndexDataMapFactory class
    +      Class<? extends IndexDataMapFactory> factoryClass =
    +          (Class<? extends IndexDataMapFactory>) 
Class.forName(dataMapSchema.getClassName());
    +      indexDataMapFactory = factoryClass.newInstance();
    +    } catch (ClassNotFoundException e) {
    +      throw new MalformedDataMapCommandException(
    +          "DataMap '" + dataMapSchema.getClassName() + "' not found");
    +    } catch (Throwable e) {
    +      throw new MetadataProcessException(
    +          "failed to create DataMap '" + dataMapSchema.getClassName() + 
"'", e);
    +    }
    +    return registerDataMap(identifier, dataMapSchema, indexDataMapFactory);
    +  }
    +
    +  public TableDataMap registerDataMap(AbsoluteTableIdentifier identifier,
    --- End diff --
    
    use private modifier


---

Reply via email to