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




graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusElement.java
Lines 79 (patched)
<https://reviews.apache.org/r/71012/#comment303626>

    For an attribute of type 'biginteger' why would the propertyValue, the 
value stored in a vertex/edge property, be of any type other than BigInteger? 
This needs to be investigated.
    
    Also, consider updating the fix here as below:
    
      if (BigInteger.class == clazz) {
        if (propertyValue instanceof BigInteger) { // from 
AtlasBigIntegerType.getNormalizedValue()
          return (T) propertyValue;
        } else if (propertyValue instanceof BigDecimal) {
          return (T) ((BigDecimal) propertyValue).toBigInteger();
        } else if (obj instanceof Number) {
          return (T) BigInteger.valueOf(((Number) obj).longValue());
        } else {
          return new BigDecimal(obj.toString()).toBigInteger();
        }
      } else if (BigDecimal.class == clazz) {
        ..  similar to above block, but from 
AtlasBigDecimalType.getNormalizedValue()
      }


- Madhan Neethiraj


On July 4, 2019, 2:19 p.m., mayank jain wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/71012/
> -----------------------------------------------------------
> 
> (Updated July 4, 2019, 2:19 p.m.)
> 
> 
> Review request for atlas, Ashutosh Mestry, Madhan Neethiraj, Nixon Rodrigues, 
> and Sarath Subramanian.
> 
> 
> Bugs: ATLAS-3310
>     https://issues.apache.org/jira/browse/ATLAS-3310
> 
> 
> Repository: atlas
> 
> 
> Description
> -------
> 
> This patch will provide the fix to the BigInteger attributes in relationship.
> 
> Working on Unit test case for testing BigInteger case.
> 
> 
> Diffs
> -----
> 
>   
> graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusElement.java
>  a9cc5a6 
> 
> 
> Diff: https://reviews.apache.org/r/71012/diff/1/
> 
> 
> Testing
> -------
> 
> Modified the relationship attributes of hive_table and column with the below 
> mentioned API :
> link used: localhost:21000/api/atlas/v2/types/typedefs
> Request Type : PUT
> JSON : 
> {     
>           "relationshipDefs": [
>               {
>             "category": "RELATIONSHIP",
>             "guid": "8339e074-8a76-4ab6-b716-2e6a5883c158",
>             "createdBy": "mayank",
>             "updatedBy": "mayank",
>             "createTime": 1561985660068,
>             "updateTime": 1561985660068,
>             "version": 1,
>             "name": "hive_table_columns",
>             "description": "hive_table_columns",
>             "typeVersion": "1.2",
>             "serviceType": "hive",
>             "attributeDefs": [
>               {
>                     "name": "description",
>                     "typeName": "string",
>                     "isOptional": true,
>                     "cardinality": "SINGLE",
>                     "valuesMinCount": 0,
>                     "valuesMaxCount": 1,
>                     "isUnique": false,
>                     "isIndexable": true,
>                     "includeInNotification": false,
>                     "description": "A sample attr for holdig ddescription 
> type of attribute",
>                     "searchWeight": -1
>                 },
>               {
>                     "name": "samplebigint",
>                     "typeName": "biginteger",
>                     "isOptional": true,
>                     "cardinality": "SINGLE",
>                     "valuesMinCount": 0,
>                     "valuesMaxCount": 1,
>                     "isUnique": false,
>                     "isIndexable": true,
>                     "includeInNotification": false,
>                     "description": "A sample attr for holdig BigInteger type 
> of data",
>                     "searchWeight": -1
>                 }
>               ],
>             "relationshipCategory": "COMPOSITION",
>             "relationshipLabel": "__hive_table.columns",
>             "propagateTags": "NONE",
>             "endDef1": {
>                 "type": "hive_table",
>                 "name": "columns",
>                 "isContainer": true,
>                 "cardinality": "SET",
>                 "isLegacyAttribute": true
>             },
>             "endDef2": {
>                 "type": "hive_column",
>                 "name": "table",
>                 "isContainer": false,
>                 "cardinality": "SINGLE",
>                 "isLegacyAttribute": true
>             }
>           }
>       ]
> }
> ======================================================================================================
> After this  we can create a relationship between a hive table and a hive 
> column using below mentioned API request
> Now this request provides values for BigInteger Type and the values are been 
> succesfully converted to respective types without misbehaving.
> Link used : http://localhost:21000/api/atlas/v2/relationship
> Request Type : POST
> JSON :
> {
> "end1" :
> 
> { "guid" : "4d5adf00-2c9b-4877-ad23-c41fd7319150" }
> ,
> "end2" :
>       
> { "guid" : "b0d889d1-008f-44ba-85cd-ab43abbb9a00" }
> ,
> "typeName":"hive_table_columns",
> "attributes" : {
>       "description" : "It is a very good description ",
>       "samplebigint" : 3218888888888888
>       
> }
> }
> ======================================================================================================
> 
> 
> Thanks,
> 
> mayank jain
> 
>

Reply via email to