Re: Review Request 52954: ATLAS-1227: added support for attribute constraints in the model

2016-10-18 Thread Suma Shivaprasad

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


Ship it!




Ship It!

- Suma Shivaprasad


On Oct. 18, 2016, 8:38 p.m., Madhan Neethiraj wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/52954/
> ---
> 
> (Updated Oct. 18, 2016, 8:38 p.m.)
> 
> 
> Review request for atlas.
> 
> 
> Bugs: ATLAS-1227
> https://issues.apache.org/jira/browse/ATLAS-1227
> 
> 
> Repository: atlas
> 
> 
> Description
> ---
> 
> Added support for constraints in entity attributes. Following 2 constraints 
> are added in this patch, which provide equivalent of isComposite and 
> reverseAtributeName fields in AttributeInfo: foreignKey, mappedFromRef.
> 
> Using these constraints, hive_column.table and hive_table.columns would be 
> modeled as below:
> 
> {
>   "name": "hive_column",
>   "attributeDefs": [
> {
>   "name": "table",
>   "typeName": "hive_table",
>   "constraintDefs": [
> {
>   "type": "foreignKey",
>   "params": {
> "onDelete": "cascade"
>   }
> }
>   ]
> }
>   ]
> }
> 
> {
>   "name": "hive_table",
>   "attributeDefs": [
> {
>   "name": "columns",
>   "typeName": "array",
>   "constraintDefs": [
> {
>   "type": "mappedFromRef",
>   "params": {
> "refAttribute": "table"
>   }
> }
>   ]
> }
>   ]
> }
> 
> 
> Diffs
> -
> 
>   intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java 
> 55bff2b 
>   intg/src/main/java/org/apache/atlas/type/AtlasStructType.java 8813542 
>   intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java 264e9a8 
>   intg/src/test/java/org/apache/atlas/type/TestAtlasEntityType.java 5b38e3c 
>   
> repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java
>  78cbd63 
>   
> repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
>  f36c0d6 
>   
> repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
>  ea1b03b 
> 
> Diff: https://reviews.apache.org/r/52954/diff/
> 
> 
> Testing
> ---
> 
> - added unit tests
> - verified that existing isComposite/reverseAttributeName fields are mapped 
> to constraints correctly (when accessing entity-def via TypesREST API)
> 
> 
> Thanks,
> 
> Madhan Neethiraj
> 
>



Re: Review Request 52954: ATLAS-1227: added support for attribute constraints in the model

2016-10-18 Thread Madhan Neethiraj

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

(Updated Oct. 18, 2016, 8:38 p.m.)


Review request for atlas.


Changes
---

updates for the review comments


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


Repository: atlas


Description
---

Added support for constraints in entity attributes. Following 2 constraints are 
added in this patch, which provide equivalent of isComposite and 
reverseAtributeName fields in AttributeInfo: foreignKey, mappedFromRef.

Using these constraints, hive_column.table and hive_table.columns would be 
modeled as below:

{
  "name": "hive_column",
  "attributeDefs": [
{
  "name": "table",
  "typeName": "hive_table",
  "constraintDefs": [
{
  "type": "foreignKey",
  "params": {
"onDelete": "cascade"
  }
}
  ]
}
  ]
}

{
  "name": "hive_table",
  "attributeDefs": [
{
  "name": "columns",
  "typeName": "array",
  "constraintDefs": [
{
  "type": "mappedFromRef",
  "params": {
"refAttribute": "table"
  }
}
  ]
}
  ]
}


Diffs (updated)
-

  intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java 55bff2b 
  intg/src/main/java/org/apache/atlas/type/AtlasStructType.java 8813542 
  intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java 264e9a8 
  intg/src/test/java/org/apache/atlas/type/TestAtlasEntityType.java 5b38e3c 
  
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java
 78cbd63 
  
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
 f36c0d6 
  
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
 ea1b03b 

Diff: https://reviews.apache.org/r/52954/diff/


Testing
---

- added unit tests
- verified that existing isComposite/reverseAttributeName fields are mapped to 
constraints correctly (when accessing entity-def via TypesREST API)


Thanks,

Madhan Neethiraj



Re: Review Request 52954: ATLAS-1227: added support for attribute constraints in the model

2016-10-18 Thread Suma Shivaprasad

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




repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
 (line 452)


if reverserAttributeName is null, why do we need to set isComposite to 
true? Then it translates only to foreign key being true, correct?


- Suma Shivaprasad


On Oct. 18, 2016, 6:27 p.m., Madhan Neethiraj wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/52954/
> ---
> 
> (Updated Oct. 18, 2016, 6:27 p.m.)
> 
> 
> Review request for atlas.
> 
> 
> Bugs: ATLAS-1227
> https://issues.apache.org/jira/browse/ATLAS-1227
> 
> 
> Repository: atlas
> 
> 
> Description
> ---
> 
> Added support for constraints in entity attributes. Following 2 constraints 
> are added in this patch, which provide equivalent of isComposite and 
> reverseAtributeName fields in AttributeInfo: foreignKey, mappedFromRef.
> 
> Using these constraints, hive_column.table and hive_table.columns would be 
> modeled as below:
> 
> {
>   "name": "hive_column",
>   "attributeDefs": [
> {
>   "name": "table",
>   "typeName": "hive_table",
>   "constraintDefs": [
> {
>   "type": "foreignKey",
>   "params": {
> "onDelete": "cascade"
>   }
> }
>   ]
> }
>   ]
> }
> 
> {
>   "name": "hive_table",
>   "attributeDefs": [
> {
>   "name": "columns",
>   "typeName": "array",
>   "constraintDefs": [
> {
>   "type": "mappedFromRef",
>   "params": {
> "refAttribute": "table"
>   }
> }
>   ]
> }
>   ]
> }
> 
> 
> Diffs
> -
> 
>   intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java 
> 55bff2b 
>   intg/src/main/java/org/apache/atlas/type/AtlasStructType.java 8813542 
>   intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java 264e9a8 
>   intg/src/test/java/org/apache/atlas/type/TestAtlasEntityType.java 5b38e3c 
>   
> repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
>  ea1b03b 
> 
> Diff: https://reviews.apache.org/r/52954/diff/
> 
> 
> Testing
> ---
> 
> - added unit tests
> - verified that existing isComposite/reverseAttributeName fields are mapped 
> to constraints correctly (when accessing entity-def via TypesREST API)
> 
> 
> Thanks,
> 
> Madhan Neethiraj
> 
>



Re: Review Request 52954: ATLAS-1227: added support for attribute constraints in the model

2016-10-18 Thread Suma Shivaprasad

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




repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
 (line 527)


can you pls add comments for this block and the cases it handles. Would be 
easier to understand later


- Suma Shivaprasad


On Oct. 18, 2016, 6:27 p.m., Madhan Neethiraj wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/52954/
> ---
> 
> (Updated Oct. 18, 2016, 6:27 p.m.)
> 
> 
> Review request for atlas.
> 
> 
> Bugs: ATLAS-1227
> https://issues.apache.org/jira/browse/ATLAS-1227
> 
> 
> Repository: atlas
> 
> 
> Description
> ---
> 
> Added support for constraints in entity attributes. Following 2 constraints 
> are added in this patch, which provide equivalent of isComposite and 
> reverseAtributeName fields in AttributeInfo: foreignKey, mappedFromRef.
> 
> Using these constraints, hive_column.table and hive_table.columns would be 
> modeled as below:
> 
> {
>   "name": "hive_column",
>   "attributeDefs": [
> {
>   "name": "table",
>   "typeName": "hive_table",
>   "constraintDefs": [
> {
>   "type": "foreignKey",
>   "params": {
> "onDelete": "cascade"
>   }
> }
>   ]
> }
>   ]
> }
> 
> {
>   "name": "hive_table",
>   "attributeDefs": [
> {
>   "name": "columns",
>   "typeName": "array",
>   "constraintDefs": [
> {
>   "type": "mappedFromRef",
>   "params": {
> "refAttribute": "table"
>   }
> }
>   ]
> }
>   ]
> }
> 
> 
> Diffs
> -
> 
>   intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java 
> 55bff2b 
>   intg/src/main/java/org/apache/atlas/type/AtlasStructType.java 8813542 
>   intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java 264e9a8 
>   intg/src/test/java/org/apache/atlas/type/TestAtlasEntityType.java 5b38e3c 
>   
> repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
>  ea1b03b 
> 
> Diff: https://reviews.apache.org/r/52954/diff/
> 
> 
> Testing
> ---
> 
> - added unit tests
> - verified that existing isComposite/reverseAttributeName fields are mapped 
> to constraints correctly (when accessing entity-def via TypesREST API)
> 
> 
> Thanks,
> 
> Madhan Neethiraj
> 
>



Re: Review Request 52954: ATLAS-1227: added support for attribute constraints in the model

2016-10-18 Thread Suma Shivaprasad

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




repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
 (line 491)


can we explicitly throw an error for map types not being handled for 
foreign key/mappedfromref and  reverseAttributeName and isComposite?


- Suma Shivaprasad


On Oct. 18, 2016, 6:27 p.m., Madhan Neethiraj wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/52954/
> ---
> 
> (Updated Oct. 18, 2016, 6:27 p.m.)
> 
> 
> Review request for atlas.
> 
> 
> Bugs: ATLAS-1227
> https://issues.apache.org/jira/browse/ATLAS-1227
> 
> 
> Repository: atlas
> 
> 
> Description
> ---
> 
> Added support for constraints in entity attributes. Following 2 constraints 
> are added in this patch, which provide equivalent of isComposite and 
> reverseAtributeName fields in AttributeInfo: foreignKey, mappedFromRef.
> 
> Using these constraints, hive_column.table and hive_table.columns would be 
> modeled as below:
> 
> {
>   "name": "hive_column",
>   "attributeDefs": [
> {
>   "name": "table",
>   "typeName": "hive_table",
>   "constraintDefs": [
> {
>   "type": "foreignKey",
>   "params": {
> "onDelete": "cascade"
>   }
> }
>   ]
> }
>   ]
> }
> 
> {
>   "name": "hive_table",
>   "attributeDefs": [
> {
>   "name": "columns",
>   "typeName": "array",
>   "constraintDefs": [
> {
>   "type": "mappedFromRef",
>   "params": {
> "refAttribute": "table"
>   }
> }
>   ]
> }
>   ]
> }
> 
> 
> Diffs
> -
> 
>   intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java 
> 55bff2b 
>   intg/src/main/java/org/apache/atlas/type/AtlasStructType.java 8813542 
>   intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java 264e9a8 
>   intg/src/test/java/org/apache/atlas/type/TestAtlasEntityType.java 5b38e3c 
>   
> repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
>  ea1b03b 
> 
> Diff: https://reviews.apache.org/r/52954/diff/
> 
> 
> Testing
> ---
> 
> - added unit tests
> - verified that existing isComposite/reverseAttributeName fields are mapped 
> to constraints correctly (when accessing entity-def via TypesREST API)
> 
> 
> Thanks,
> 
> Madhan Neethiraj
> 
>



Re: Review Request 52954: ATLAS-1227: added support for attribute constraints in the model

2016-10-18 Thread Madhan Neethiraj

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

(Updated Oct. 18, 2016, 6:27 p.m.)


Review request for atlas.


Changes
---

fixes in AtlasAttributeDef persistence in graph vertex - to set 
isComposite/reverseAttributeName fields


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


Repository: atlas


Description
---

Added support for constraints in entity attributes. Following 2 constraints are 
added in this patch, which provide equivalent of isComposite and 
reverseAtributeName fields in AttributeInfo: foreignKey, mappedFromRef.

Using these constraints, hive_column.table and hive_table.columns would be 
modeled as below:

{
  "name": "hive_column",
  "attributeDefs": [
{
  "name": "table",
  "typeName": "hive_table",
  "constraintDefs": [
{
  "type": "foreignKey",
  "params": {
"onDelete": "cascade"
  }
}
  ]
}
  ]
}

{
  "name": "hive_table",
  "attributeDefs": [
{
  "name": "columns",
  "typeName": "array",
  "constraintDefs": [
{
  "type": "mappedFromRef",
  "params": {
"refAttribute": "table"
  }
}
  ]
}
  ]
}


Diffs (updated)
-

  intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java 55bff2b 
  intg/src/main/java/org/apache/atlas/type/AtlasStructType.java 8813542 
  intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java 264e9a8 
  intg/src/test/java/org/apache/atlas/type/TestAtlasEntityType.java 5b38e3c 
  
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
 ea1b03b 

Diff: https://reviews.apache.org/r/52954/diff/


Testing
---

- added unit tests
- verified that existing isComposite/reverseAttributeName fields are mapped to 
constraints correctly (when accessing entity-def via TypesREST API)


Thanks,

Madhan Neethiraj



Re: Review Request 52954: ATLAS-1227: added support for attribute constraints in the model

2016-10-18 Thread Suma Shivaprasad

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




repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
 (line 420)


should we flag this as an error since the user might expect an error or the 
reference to be associated at this stage?


- Suma Shivaprasad


On Oct. 18, 2016, 2:52 a.m., Madhan Neethiraj wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/52954/
> ---
> 
> (Updated Oct. 18, 2016, 2:52 a.m.)
> 
> 
> Review request for atlas.
> 
> 
> Bugs: ATLAS-1227
> https://issues.apache.org/jira/browse/ATLAS-1227
> 
> 
> Repository: atlas
> 
> 
> Description
> ---
> 
> Added support for constraints in entity attributes. Following 2 constraints 
> are added in this patch, which provide equivalent of isComposite and 
> reverseAtributeName fields in AttributeInfo: foreignKey, mappedFromRef.
> 
> Using these constraints, hive_column.table and hive_table.columns would be 
> modeled as below:
> 
> {
>   "name": "hive_column",
>   "attributeDefs": [
> {
>   "name": "table",
>   "typeName": "hive_table",
>   "constraintDefs": [
> {
>   "type": "foreignKey",
>   "params": {
> "onDelete": "cascade"
>   }
> }
>   ]
> }
>   ]
> }
> 
> {
>   "name": "hive_table",
>   "attributeDefs": [
> {
>   "name": "columns",
>   "typeName": "array",
>   "constraintDefs": [
> {
>   "type": "mappedFromRef",
>   "params": {
> "refAttribute": "table"
>   }
> }
>   ]
> }
>   ]
> }
> 
> 
> Diffs
> -
> 
>   intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java 
> 55bff2b 
>   intg/src/main/java/org/apache/atlas/type/AtlasStructType.java 8813542 
>   intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java 264e9a8 
>   intg/src/test/java/org/apache/atlas/type/TestAtlasEntityType.java 5b38e3c 
>   
> repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
>  ea1b03b 
> 
> Diff: https://reviews.apache.org/r/52954/diff/
> 
> 
> Testing
> ---
> 
> - added unit tests
> - verified that existing isComposite/reverseAttributeName fields are mapped 
> to constraints correctly (when accessing entity-def via TypesREST API)
> 
> 
> Thanks,
> 
> Madhan Neethiraj
> 
>



Re: Review Request 52954: ATLAS-1227: added support for attribute constraints in the model

2016-10-17 Thread Madhan Neethiraj

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

(Updated Oct. 18, 2016, 2:52 a.m.)


Review request for atlas.


Changes
---

updated to address review comments.


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


Repository: atlas


Description
---

Added support for constraints in entity attributes. Following 2 constraints are 
added in this patch, which provide equivalent of isComposite and 
reverseAtributeName fields in AttributeInfo: foreignKey, mappedFromRef.

Using these constraints, hive_column.table and hive_table.columns would be 
modeled as below:

{
  "name": "hive_column",
  "attributeDefs": [
{
  "name": "table",
  "typeName": "hive_table",
  "constraintDefs": [
{
  "type": "foreignKey",
  "params": {
"onDelete": "cascade"
  }
}
  ]
}
  ]
}

{
  "name": "hive_table",
  "attributeDefs": [
{
  "name": "columns",
  "typeName": "array",
  "constraintDefs": [
{
  "type": "mappedFromRef",
  "params": {
"refAttribute": "table"
  }
}
  ]
}
  ]
}


Diffs (updated)
-

  intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java 55bff2b 
  intg/src/main/java/org/apache/atlas/type/AtlasStructType.java 8813542 
  intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java 264e9a8 
  intg/src/test/java/org/apache/atlas/type/TestAtlasEntityType.java 5b38e3c 
  
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
 ea1b03b 

Diff: https://reviews.apache.org/r/52954/diff/


Testing
---

- added unit tests
- verified that existing isComposite/reverseAttributeName fields are mapped to 
constraints correctly (when accessing entity-def via TypesREST API)


Thanks,

Madhan Neethiraj



Re: Review Request 52954: ATLAS-1227: added support for attribute constraints in the model

2016-10-17 Thread Suma Shivaprasad

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




intg/src/main/java/org/apache/atlas/type/AtlasStructType.java (line 359)


need to handle case where foreign key is set independently with onDelete = 
null which translates to reverseAttributeName like we discussed


- Suma Shivaprasad


On Oct. 17, 2016, 7:24 p.m., Madhan Neethiraj wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/52954/
> ---
> 
> (Updated Oct. 17, 2016, 7:24 p.m.)
> 
> 
> Review request for atlas.
> 
> 
> Bugs: ATLAS-1227
> https://issues.apache.org/jira/browse/ATLAS-1227
> 
> 
> Repository: atlas
> 
> 
> Description
> ---
> 
> Added support for constraints in entity attributes. Following 2 constraints 
> are added in this patch, which provide equivalent of isComposite and 
> reverseAtributeName fields in AttributeInfo: foreignKey, mappedFromRef.
> 
> Using these constraints, hive_column.table and hive_table.columns would be 
> modeled as below:
> 
> {
>   "name": "hive_column",
>   "attributeDefs": [
> {
>   "name": "table",
>   "typeName": "hive_table",
>   "constraintDefs": [
> {
>   "type": "foreignKey",
>   "params": {
> "onDelete": "cascade"
>   }
> }
>   ]
> }
>   ]
> }
> 
> {
>   "name": "hive_table",
>   "attributeDefs": [
> {
>   "name": "columns",
>   "typeName": "array",
>   "constraintDefs": [
> {
>   "type": "mappedFromRef",
>   "params": {
> "refAttribute": "table"
>   }
> }
>   ]
> }
>   ]
> }
> 
> 
> Diffs
> -
> 
>   intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java 
> 55bff2b 
>   intg/src/main/java/org/apache/atlas/type/AtlasStructType.java 8813542 
>   intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java 264e9a8 
>   intg/src/test/java/org/apache/atlas/type/TestAtlasEntityType.java 5b38e3c 
>   
> repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
>  ea1b03b 
> 
> Diff: https://reviews.apache.org/r/52954/diff/
> 
> 
> Testing
> ---
> 
> - added unit tests
> - verified that existing isComposite/reverseAttributeName fields are mapped 
> to constraints correctly (when accessing entity-def via TypesREST API)
> 
> 
> Thanks,
> 
> Madhan Neethiraj
> 
>