You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by QiangCai <gi...@git.apache.org> on 2018/02/23 11:10:06 UTC
[GitHub] carbondata pull request #1987: [CARBONDATA-2189] Add DataMapProvider develop...
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
---