----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/58434/ -----------------------------------------------------------
(Updated June 1, 2017, 10:28 p.m.) Review request for atlas and Madhan Neethiraj. Changes ------- Updates: - Addressed review comments. - Implemented additional option to _AtlasImportRequest_ to conditionally import attributes. Bugs: ATLAS-1734 https://issues.apache.org/jira/browse/ATLAS-1734 Repository: atlas Description (updated) ------- **Background** Existing version of Import API allows for importing types that are not already present in the system being imported in. This causes import to fail in the cases where the data being imported happens to have the additional attribute. **Approach** New class _TypeAttributeDifference_ does a attribute diff betweeing 2 types. _ImportService.processTypeDefs_ method now includes additional step for attribute updation. Metrics have been updated to reflect the updates. **CURL** The ZIP files mentioned below can be found at: _repository/src/test/resources/_ Create a file _importOptions.json_ with contents below: ```javascript { "options": { "updateAttributes": true } } ``` Use the following curl to perform an import with default attributes. ```javascript curl -g -X POST -u admin:admin -H "Content-Type: multipart/form-data" -H "Cache-Control: no-cache" -F data=@salesNewTypeAttrs.zip "http://localhost:21000/api/atlas/admin/import" ``` Note the attributes of the tables. Then perform this import with the new option. ```javascript curl -g -X POST -u admin:admin -H "Content-Type: multipart/form-data" -H "Cache-Control: no-cache" -F request=@importOptions.json -F data=@salesNewTypeAttrs-next.zip "http://localhost:21000/api/atlas/admin/import" ``` **Impact to API Consumer** None. Diffs (updated) ----- intg/src/main/java/org/apache/atlas/model/impexp/AtlasImportRequest.java 7530196d pom.xml 4360604f repository/src/main/java/org/apache/atlas/repository/impexp/EntityAttributeTransformer.java PRE-CREATION repository/src/main/java/org/apache/atlas/repository/impexp/ExportService.java 7744c781 repository/src/main/java/org/apache/atlas/repository/impexp/ImportService.java 9ec15e00 repository/src/main/java/org/apache/atlas/repository/impexp/ImportTransformers.java PRE-CREATION repository/src/main/java/org/apache/atlas/repository/impexp/ImportTransforms.java PRE-CREATION repository/src/main/java/org/apache/atlas/repository/impexp/TypeAttributeDifference.java PRE-CREATION repository/src/main/java/org/apache/atlas/repository/impexp/ZipSource.java 87c9f0eb repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java 27c0b5d4 repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStreamForImport.java 69140e69 repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityImportStream.java 0f711db4 repository/src/test/java/org/apache/atlas/repository/impexp/AtlasImportRequestTest.java PRE-CREATION repository/src/test/java/org/apache/atlas/repository/impexp/EntityAttributeTransformerTest.java PRE-CREATION repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceReportingTest.java 0aaaa704 repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceTest.java 08e9ee81 repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceTestUtils.java PRE-CREATION repository/src/test/java/org/apache/atlas/repository/impexp/ImportTransformersJSONTest.java PRE-CREATION repository/src/test/java/org/apache/atlas/repository/impexp/ImportTransformersTest.java PRE-CREATION repository/src/test/java/org/apache/atlas/repository/impexp/TypeAttributeDifferenceTest.java PRE-CREATION repository/src/test/java/org/apache/atlas/repository/impexp/UniqueListTest.java PRE-CREATION repository/src/test/java/org/apache/atlas/repository/impexp/ZipSourceTest.java 8b042d7a repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1BulkImportPercentTest.java PRE-CREATION repository/src/test/resources/salesNewTypeAttrs-next.zip PRE-CREATION repository/src/test/resources/salesNewTypeAttrs.zip PRE-CREATION webapp/pom.xml 4132912d webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java 01f9a860 Diff: https://reviews.apache.org/r/58434/diff/2/ Changes: https://reviews.apache.org/r/58434/diff/1-2/ Testing ------- **Unit tests** - _ImportServiceTest_ Updated to handle the new case. New light-weight _zip_ files added test resources to verify the functionality. - _TypeAttributeDifferenceTest_ Unit test for _TypeAttributeDifference_ class. - Additional unit tests: _UniqueList_. - Import-Export APIs verified with test file set. Thanks, Ashutosh Mestry