[ 
https://issues.apache.org/jira/browse/ATLAS-3021?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lin Han updated ATLAS-3021:
---------------------------
    Issue Type: Bug  (was: Improvement)

> A question of the index key of eneity's attribute 
> --------------------------------------------------
>
>                 Key: ATLAS-3021
>                 URL: https://issues.apache.org/jira/browse/ATLAS-3021
>             Project: Atlas
>          Issue Type: Bug
>          Components:  atlas-core, atlas-intg
>    Affects Versions: 1.1.0
>         Environment: centos
>            Reporter: Lin Han
>            Priority: Major
>
> hi, guys
> At these days, When i want to improve the efficiency of atlas create new 
> entity by use the function "createOrUpdate" of AtlasEntityStoreV2, so i find 
> the way to use the index.
> 1.add the config 
> "atlas.use.index.query.to.find.entity.by.unique.attributes=true" to my 
> atlas-application.properties, 
> 2.add the config "<isIndexable>true</isIndexable>" to the attribute of my 
> ClassType define xml, like this :
> {code:java}
> //代码占位符
> <ClassType>
>     <name>HDFSDir</name>
>     <desc>HDFS directory</desc>
>     <attrs>
>         <attr>
>             <name>contextPath</name>
>             <desc>HDFS directory contextPath</desc>
>             <isOptional>false</isOptional>
>             <isIndexable>true</isIndexable>
>             <typeName>string</typeName>
>             <isUnique>true</isUnique>
>             <cardinality>single</cardinality>
>             <extInfo>
>             <item key="canconfig" value="false"/>
>                 </extInfo>
>             </attr>
> ...
> {code}
> The question is that i find the "canUseIndexQuery" function code of 
> AtlasGraphUtilsV2.java always return false
> {code:java}
> //代码占位符
> private static boolean canUseIndexQuery(AtlasEntityType entityType, String 
> attributeName) {
>     boolean ret = false;
>     if (USE_INDEX_QUERY_TO_FIND_ENTITY_BY_UNIQUE_ATTRIBUTES) {
>         final String typeAndSubTypesQryStr = 
> entityType.getTypeAndAllSubTypesQryStr();
>         ret = typeAndSubTypesQryStr.length() <= 
> SearchProcessor.MAX_QUERY_STR_LENGTH_TYPES;
>         if (ret) {
>             Set<String> indexSet = 
> AtlasGraphProvider.getGraphInstance().getVertexIndexKeys();
>            try {
>                ret = 
> indexSet.contains(entityType.getQualifiedAttributeName(attributeName));
>            }
>             catch (AtlasBaseException ex) {
>                ret = false;
>           }
>        }
>     }
>     return ret;
> }{code}
> The indexSet contains the "HDFSDir.contextPath__superTypeNames" and 
> "HDFSDir.contextPath__typeName"(this is the index Generate by atlas due to 
> the isIndexable config),but the code 
> "entityType.getQualifiedAttributeName(attributeName)" return is 
> "HDFSDir.contextPath", so it's obvious that indexSet is not contains the 
> "HDFSDir.contextPath".
> And I also find that the function "createIndexForAttribute" of 
> GraphBackedSearchIndexer.java, the config "isIndexable=true" is to create the 
> CompositeIndexWithTypeAndSuperTypes, and it will not create the 
> CompositeIndex because the parameter createCompositeIndex is false, 
> hard-coded.
> So how to really use the index when create entity or I used it in a wrong way?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to