Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 591D0200C8E for ; Thu, 25 May 2017 07:16:28 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 57A42160BD0; Thu, 25 May 2017 05:16:28 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 76CB8160BB6 for ; Thu, 25 May 2017 07:16:27 +0200 (CEST) Received: (qmail 43089 invoked by uid 500); 25 May 2017 05:16:26 -0000 Mailing-List: contact dev-help@atlas.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@atlas.incubator.apache.org Delivered-To: mailing list dev@atlas.incubator.apache.org Received: (qmail 43067 invoked by uid 99); 25 May 2017 05:16:26 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 May 2017 05:16:26 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 9E2211A042B; Thu, 25 May 2017 05:16:25 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3 X-Spam-Level: *** X-Spam-Status: No, score=3 tagged_above=-999 required=6.31 tests=[HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=2, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id AlgDPKZh8zRd; Thu, 25 May 2017 05:16:23 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 6D76E5F249; Thu, 25 May 2017 05:16:23 +0000 (UTC) Received: from reviews.apache.org (unknown [10.41.0.12]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 0A5E1E0373; Thu, 25 May 2017 05:16:23 +0000 (UTC) Received: from reviews-vm2.apache.org (localhost [IPv6:::1]) by reviews.apache.org (ASF Mail Server at reviews-vm2.apache.org) with ESMTP id F0988C400A3; Thu, 25 May 2017 05:16:22 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============5423082365507916644==" MIME-Version: 1.0 Subject: Re: Review Request 56959: Import API: Added Support for Transforming Entities During Import From: Ashutosh Mestry To: Madhan Neethiraj Cc: Ashutosh Mestry , atlas , Apoorv Naik Date: Thu, 25 May 2017 05:16:22 -0000 Message-ID: <20170525051622.61833.35088@reviews-vm2.apache.org> X-ReviewBoard-URL: https://reviews.apache.org/ Auto-Submitted: auto-generated Sender: Ashutosh Mestry X-ReviewGroup: atlas X-Auto-Response-Suppress: DR, RN, OOF, AutoReply X-ReviewRequest-URL: https://reviews.apache.org/r/56959/ X-Sender: Ashutosh Mestry References: <20170524231551.1142.63235@reviews-vm2.apache.org> In-Reply-To: <20170524231551.1142.63235@reviews-vm2.apache.org> X-ReviewBoard-Diff-For: repository/src/test/java/org/apache/atlas/repository/impexp/ImportEntityTransformerTest.java X-ReviewBoard-Diff-For: repository/src/main/java/org/apache/atlas/repository/impexp/ImportEntityTransformer.java X-ReviewBoard-Diff-For: intg/src/main/java/org/apache/atlas/model/impexp/ImportTransformerEnum.java X-ReviewBoard-Diff-For: intg/src/test/java/org/apache/atlas/model/impexp/ImportTransformerEnumTest.java X-ReviewBoard-Diff-For: intg/src/main/java/org/apache/atlas/model/impexp/AtlasImportTransforms.java X-ReviewBoard-Diff-For: repository/src/test/java/org/apache/atlas/repository/impexp/TransformEvaluatorTest.java Reply-To: Ashutosh Mestry X-ReviewRequest-Repository: atlas archived-at: Thu, 25 May 2017 05:16:28 -0000 --===============5423082365507916644== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/56959/ ----------------------------------------------------------- (Updated May 25, 2017, 5:16 a.m.) Review request for atlas and Madhan Neethiraj. Changes ------- Fixed problem with enum used as factory. Bugs: ATLAS-1825 https://issues.apache.org/jira/browse/ATLAS-1825 Repository: atlas Description ------- Please refer to [ATLAS-1825](https://issues.apache.org/jira/browse/ATLAS-1825) for scenarios and solution approach. Impact ====== * New class _AtlasImportTransform_ is now part of _AtlasImportRequest_. This holds a map of entity-type to attribute and the tranforms to be applied. * New class _AtlasImportTransformBuiler_ reads the requests specified in the query string of the import API and creates a _AtlasImportTransfor_ structure. * _AtlasImportTransformBuiler_ has new classes that support transformations. They are: * _replace_ Implements find and replace on attribute values. * _lowercase_ Converts attribute value to lower case. * Additional classes that unit test these classes have been added. Implementation Approach ======================= * _ZipSource_ now accepts _AtlasImportTransform_ object. It applies the transform every entity that is fetched from the source. * _Import API_ now accepts multi-part input. This allows for elegantly specifying import parameters as well as the binary input from the file. * Please take note of _ImportTransformerEnum_. This is first case where Enum has state variables. CURL ==== *Setup* Create file with these contents call it _importTransform.json_: ```javascript { "options": {}, "importTransform": { "transforms": { "hive_table": { "qualifiedName": [ "lowercase", "replace:@cl1:@cl2" ] } } } } ``` ``` curl -g -X POST -u admin:admin -H "Content-Type: multipart/form-data" -H "Cache-Control: no-cache" -F request=@../docs/importTransform.json -F data=@../docs/Stocks-2.zip "http://localhost:21000/api/atlas/admin/import" ``` Note: _-g_ needs to be added to CURL calls to prevent gobble check. This is not required anymore. Notice the output from the API, it has the _AtlasRequest_ that was passed as input. Documentation ============= Need to update TWIKI documents. Diffs (updated) ----- intg/src/main/java/org/apache/atlas/model/impexp/AtlasImportRequest.java 7530196d intg/src/main/java/org/apache/atlas/model/impexp/AtlasImportTransforms.java PRE-CREATION intg/src/main/java/org/apache/atlas/model/impexp/ImportTransformerEnum.java PRE-CREATION intg/src/test/java/org/apache/atlas/model/impexp/ImportTransformerEnumTest.java PRE-CREATION pom.xml a93b8ad9 repository/src/main/java/org/apache/atlas/repository/impexp/ImportEntityTransformer.java PRE-CREATION repository/src/main/java/org/apache/atlas/repository/impexp/ImportService.java 9ec15e00 repository/src/main/java/org/apache/atlas/repository/impexp/ZipSource.java 87c9f0eb repository/src/test/java/org/apache/atlas/repository/impexp/ImportEntityTransformerTest.java PRE-CREATION repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceTest.java 08e9ee81 repository/src/test/java/org/apache/atlas/repository/impexp/TransformEvaluatorTest.java PRE-CREATION repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java d4900838 webapp/pom.xml 4132912d webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java 01f9a860 Diff: https://reviews.apache.org/r/56959/diff/6/ Changes: https://reviews.apache.org/r/56959/diff/5-6/ Testing ------- **Unit Test** * Added tests for *AtlasImportTransformBuilder* and contained classes. * Updated *ZipSourceTest* * Added tests to *ImportServiceTest* to exercise new option. **Functional Test** * Small size data export & import. * Medium size data export & import. **Performance Tests** Not exhaustive. Simple stop watch tests to compare against baseline. Thanks, Ashutosh Mestry --===============5423082365507916644==--