You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@atlas.apache.org by Nixon Rodrigues <ni...@freestoneinfotech.com> on 2021/07/12 14:41:44 UTC

Review Request 73453: ATLAS-4353 - Atlas typedef name issue with name="name"

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/73453/
-----------------------------------------------------------

Review request for atlas, Ashutosh Mestry, Jayendra Parab, Nikhil Bonte, Pinal Shah, and Sarath Subramanian.


Bugs: ATLAS-4353
    https://issues.apache.org/jira/browse/ATLAS-4353


Repository: atlas


Description
-------

In Atlas, when we create a new classification with name of "name", then the result is it will create a classification named "[]"  after that if we tried to remove it then it will failed and even we tried with API to remove the "[]" classification, it will responding with invalid name error.

In the Graph store classification name is set with property __type.name in vertex and the list of attribute name of classification are set with property *__type.<classificationName>* in same vertex.
If classification name is set with name as "name" , then property __type.name = "name" is overridden by classification attributes with property __type.<classificationName> to empty array [ ie *__type.name=[[]]*.]


Diffs
-----

  repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java ff7fd150e 
  repository/src/main/java/org/apache/atlas/repository/patches/AtlasPatchManager.java fae28c440 
  repository/src/main/java/org/apache/atlas/repository/patches/RenameClassificationAttributeArrayKey.java PRE-CREATION 
  repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEnumDefStoreV2.java 5c02105fe 
  repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java e73f084b8 


Diff: https://reviews.apache.org/r/73453/diff/1/


Testing
-------

Tested create types with name "name" with different category.
Also tested java patch in upgrade scenario. 

https://ci-builds.apache.org/job/Atlas/job/PreCommit-ATLAS-Build-Test/744/console


Thanks,

Nixon Rodrigues


Re: Review Request 73453: ATLAS-4353 - Atlas typedef name issue with name="name"

Posted by Madhan Neethiraj <ma...@apache.org>.

> On July 15, 2021, 3:50 p.m., Madhan Neethiraj wrote:
> > repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java
> > Line 118 (original), 119 (patched)
> > <https://reviews.apache.org/r/73453/diff/2/?file=2251209#file2251209line119>
> >
> >     For type hive_table, this would change the prefix from "__hive_table" => "__attribute.hive_table".
> >     
> >     I suggest to use following prefix: "__hive_table._attr". Note that attribute names in struct/entity/classification/relationship can't begin with a leading underscore; hence use of prefix "_attr" is safe.
> >     
> >       public static final String ATTRIBUTE_PREFIX            = "._attr";
> >     
> >       public static String getTypeDefPropertyKey(String typeName) {
> >             return PROPERTY_PREFIX + typeName + ATTRIBUTE_PREFIX;
> >         }
> >     
> >         public static String getTypeDefPropertyKey(String typeName, String child) {
> >             return PROPERTY_PREFIX + typeName + ATTRIBUTE_PREFIX + "." + child;
> >         }

I think following alternate solution will be better: rename below 'internal' properties of a type vertex (defined in Constants.java):
 __type.catagory    => __type.__catagory
 __type.name        => __type.__name
 __type.description => __type.__description
 __type.version     => __type.__version
 __type.options     => __type.__option
 __type.servicetype => __type.__servicetype

This will help avoid the issue when a type with one of the following names is created: catagory/name/description/version/option/servicetype


- Madhan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/73453/#review223232
-----------------------------------------------------------


On July 12, 2021, 2:41 p.m., Nixon Rodrigues wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/73453/
> -----------------------------------------------------------
> 
> (Updated July 12, 2021, 2:41 p.m.)
> 
> 
> Review request for atlas, Ashutosh Mestry, Jayendra Parab, Madhan Neethiraj, Nikhil Bonte, Pinal Shah, and Sarath Subramanian.
> 
> 
> Bugs: ATLAS-4353
>     https://issues.apache.org/jira/browse/ATLAS-4353
> 
> 
> Repository: atlas
> 
> 
> Description
> -------
> 
> In Atlas, when we create a new classification with name of "name", then the result is it will create a classification named "[]"  after that if we tried to remove it then it will failed and even we tried with API to remove the "[]" classification, it will responding with invalid name error.
> 
> In the Graph store classification name is set with property __type.name in vertex and the list of attribute name of classification are set with property *__type.<classificationName>* in same vertex.
> If classification name is set with name as "name" , then property __type.name = "name" is overridden by classification attributes with property __type.<classificationName> to empty array [ ie *__type.name=[[]]*.]
> 
> 
> Diffs
> -----
> 
>   repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java ff7fd150e 
>   repository/src/main/java/org/apache/atlas/repository/patches/AtlasPatchManager.java fae28c440 
>   repository/src/main/java/org/apache/atlas/repository/patches/RenameClassificationAttributeArrayKey.java PRE-CREATION 
>   repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEnumDefStoreV2.java 5c02105fe 
>   repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java e73f084b8 
> 
> 
> Diff: https://reviews.apache.org/r/73453/diff/2/
> 
> 
> Testing
> -------
> 
> Tested create types with name "name" with different category.
> Also tested java patch in upgrade scenario. 
> 
> https://ci-builds.apache.org/job/Atlas/job/PreCommit-ATLAS-Build-Test/744/console
> 
> 
> Thanks,
> 
> Nixon Rodrigues
> 
>


Re: Review Request 73453: ATLAS-4353 - Atlas typedef name issue with name="name"

Posted by Madhan Neethiraj <ma...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/73453/#review223232
-----------------------------------------------------------




repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java
Line 118 (original), 119 (patched)
<https://reviews.apache.org/r/73453/#comment312324>

    For type hive_table, this would change the prefix from "__hive_table" => "__attribute.hive_table".
    
    I suggest to use following prefix: "__hive_table._attr". Note that attribute names in struct/entity/classification/relationship can't begin with a leading underscore; hence use of prefix "_attr" is safe.
    
      public static final String ATTRIBUTE_PREFIX            = "._attr";
    
      public static String getTypeDefPropertyKey(String typeName) {
            return PROPERTY_PREFIX + typeName + ATTRIBUTE_PREFIX;
        }
    
        public static String getTypeDefPropertyKey(String typeName, String child) {
            return PROPERTY_PREFIX + typeName + ATTRIBUTE_PREFIX + "." + child;
        }


- Madhan Neethiraj


On July 12, 2021, 2:41 p.m., Nixon Rodrigues wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/73453/
> -----------------------------------------------------------
> 
> (Updated July 12, 2021, 2:41 p.m.)
> 
> 
> Review request for atlas, Ashutosh Mestry, Jayendra Parab, Madhan Neethiraj, Nikhil Bonte, Pinal Shah, and Sarath Subramanian.
> 
> 
> Bugs: ATLAS-4353
>     https://issues.apache.org/jira/browse/ATLAS-4353
> 
> 
> Repository: atlas
> 
> 
> Description
> -------
> 
> In Atlas, when we create a new classification with name of "name", then the result is it will create a classification named "[]"  after that if we tried to remove it then it will failed and even we tried with API to remove the "[]" classification, it will responding with invalid name error.
> 
> In the Graph store classification name is set with property __type.name in vertex and the list of attribute name of classification are set with property *__type.<classificationName>* in same vertex.
> If classification name is set with name as "name" , then property __type.name = "name" is overridden by classification attributes with property __type.<classificationName> to empty array [ ie *__type.name=[[]]*.]
> 
> 
> Diffs
> -----
> 
>   repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java ff7fd150e 
>   repository/src/main/java/org/apache/atlas/repository/patches/AtlasPatchManager.java fae28c440 
>   repository/src/main/java/org/apache/atlas/repository/patches/RenameClassificationAttributeArrayKey.java PRE-CREATION 
>   repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEnumDefStoreV2.java 5c02105fe 
>   repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java e73f084b8 
> 
> 
> Diff: https://reviews.apache.org/r/73453/diff/2/
> 
> 
> Testing
> -------
> 
> Tested create types with name "name" with different category.
> Also tested java patch in upgrade scenario. 
> 
> https://ci-builds.apache.org/job/Atlas/job/PreCommit-ATLAS-Build-Test/744/console
> 
> 
> Thanks,
> 
> Nixon Rodrigues
> 
>