Return-Path: X-Original-To: apmail-apex-dev-archive@minotaur.apache.org Delivered-To: apmail-apex-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7DF071845D for ; Tue, 8 Mar 2016 12:18:34 +0000 (UTC) Received: (qmail 2188 invoked by uid 500); 8 Mar 2016 12:18:34 -0000 Delivered-To: apmail-apex-dev-archive@apex.apache.org Received: (qmail 2117 invoked by uid 500); 8 Mar 2016 12:18:34 -0000 Mailing-List: contact dev-help@apex.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@apex.incubator.apache.org Delivered-To: mailing list dev@apex.incubator.apache.org Received: (qmail 2105 invoked by uid 99); 8 Mar 2016 12:18:33 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Mar 2016 12:18:33 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 8281EC2067 for ; Tue, 8 Mar 2016 12:18:33 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.279 X-Spam-Level: * X-Spam-Status: No, score=1.279 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=datatorrent-com.20150623.gappssmtp.com Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 4CoC6rq6w89V for ; Tue, 8 Mar 2016 12:18:31 +0000 (UTC) Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com [74.125.82.45]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTPS id C78125F1EF for ; Tue, 8 Mar 2016 12:18:30 +0000 (UTC) Received: by mail-wm0-f45.google.com with SMTP id l68so24947632wml.1 for ; Tue, 08 Mar 2016 04:18:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datatorrent-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=UZs77+YhORwCUgpYHk+ZZyQyIKvBjpe+JdwoqZltFiU=; b=UyVnlugrlYJc1K5PfLHVEtAau/UyCjyklZ+ySz09Yjr8epaYEibq+QkvPaZMnVVOMX 9vI/KAgvR3C65m82CFov7GSHOAk+OOJGmam20l9s8Jxqk8p8b9y8qgZ4TdjzjJCEp9cP UcuOnz93iHNNSpGvmdiWyV4wt/ae/FTCZB+mwG2I2O8viNs2D6eF4uAt+EbFN8zsWrG7 J34xTEHAFDFFI5UU/hRSHufsvhNeIoqV7Ddt6hV+uOMMr4UUVR2Z+ahUaL3/KwTT/2ax y/PY2TbAxlkHZJuuw+eO8ZtWUTZf7xiYfv/P/Y3vmnC7KYOImdB0bRTvUzeS+X7HrfX0 WraA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=UZs77+YhORwCUgpYHk+ZZyQyIKvBjpe+JdwoqZltFiU=; b=AF17aInc+MpROo/kqoAEHNMwH8DP/BElHZo03Fqbct5TE/zsMy9jcisVXDRqZId6Cv LUzqIk4vwYaC/GRardv85mHSpKsHJ1dKPJATP9itOHC1EJeGceFlN1ef7XtIDqCcD2Dh uCqBCuqUs9etzeWd59hmyscQteobC2YoyHrBMc1GQ5zKw7VYoShHfv07VouhIU911V1Q tuESQ9WG8F8/boSaieDd9MoBNwJja5d0mCX2MX5fXvfRDPaP44/E2z4ZKE0xWPpazz/C CtgRvo38Quo/yKpNtnSz/UTf0prBkQatFlmSXI/niEGuAmv3K9x7cXFX4WkUtBQ9mvKN s3Hg== X-Gm-Message-State: AD7BkJJcqOgoWkmjhJ/O7Y9biFFzLUD5utRpjY89DfoC4V7oNuV16TXDrDYTsD2zJeEWblFmiP7qqyJxX6CIctSx MIME-Version: 1.0 X-Received: by 10.195.12.113 with SMTP id ep17mr27807110wjd.102.1457439509686; Tue, 08 Mar 2016 04:18:29 -0800 (PST) Received: by 10.194.138.208 with HTTP; Tue, 8 Mar 2016 04:18:29 -0800 (PST) In-Reply-To: References: Date: Tue, 8 Mar 2016 17:48:29 +0530 Message-ID: Subject: Re: Adding Transform Operator to Malhar From: Devendra Tagare To: dev@apex.incubator.apache.org Content-Type: multipart/alternative; boundary=047d7bb04c4241caa7052d8894ca --047d7bb04c4241caa7052d8894ca Content-Type: text/plain; charset=UTF-8 +1 Dev On Tue, Mar 8, 2016 at 5:38 PM, Yogi Devendra wrote: > Forgot to add in earlier email: > > +1 for this operator. > > ~ Yogi > > On 8 March 2016 at 17:03, Yogi Devendra wrote: > > > Can we think of better name than Transform operator? > > May be: > > Expression operator > > > > Reason: > > We have many operators which are doing 'transform'. So, this name looks > > very generic. > > > > In fact, from the users perspective, I always consider any operator like > a > > black-box doing some transformation. > > > > ~ Yogi > > > > On 8 March 2016 at 16:46, Mohit Jotwani wrote: > > > >> This can have as many util functions added to it to perform various > >> transformations to the tuple. > >> > >> +1 > >> > >> Regards, > >> Mohit > >> On 8 Mar 2016 16:42, "Sandeep Deshmukh" > wrote: > >> > >> > Looks good to me. > >> > > >> > Regards, > >> > Sandeep > >> > > >> > On Mon, Mar 7, 2016 at 9:51 PM, Chinmay Kolhatkar > > >> > wrote: > >> > > >> > > Dear Community, > >> > > > >> > > We're creating a transform operator which will allow the apex users > to > >> > > transform data over a stream using this operator. > >> > > > >> > > Use Case: > >> > > ---- > >> > > When the data has been received from input source, one can transform > >> data > >> > > using transform operator and then dump it to destination. > >> > > > >> > > Transform means: > >> > > ---- > >> > > 1. Conversion of fields from one type to another. Eg. int to > Integer, > >> > epoc > >> > > to java.util.Date object, int to String or String to int etc. > >> > > 2. Deriving new fields from one or more input fields. > >> > > For eg. Input contains 2 fields viz. "firstname", "lastname" and > >> > > derived field is "fullname" which is combination of firstname and > >> > lastname > >> > > in some way. > >> > > Another example is date of birth present in input tuple, > generate > >> age > >> > > from it. > >> > > 3. Change in schema from input to output. For eg. Input schema is > >> subset > >> > of > >> > > output schema and output schema contains some extra derived fields > >> from > >> > > input fields. > >> > > > >> > > > >> > > Functionality: > >> > > ---- > >> > > 1. Transform operator will access POJO as input tuple and emit > >> > another/same > >> > > POJO output tuple. > >> > > 2. Operator needs to be configured with input tuple schema and > output > >> > tuple > >> > > schema for this. This can be done via TUPLE_CLASS attribute on > ports. > >> > > 3. Generation of output tuple from input tuple can be specified > using > >> > > simple java based expressions. > >> > > For eg. > >> > > outfield1 = > >> > > outfield2 = > >> > > 4. If no expression is mentioned for a certain output field, then a > >> > > matching field (name and type) will be picked input POJO and > contents > >> > will > >> > > be copied to output POJO. > >> > > Otherwise, the output field will be left to default empty value. > >> > > > >> > > > >> > > Expression Support in PojoUtils: > >> > > ---- > >> > > 1. For achieving above functionality, I thought about extending > >> PojoUtils > >> > > which already support much of what is required. Then this utility > can > >> be > >> > > used in Transform operator. > >> > > 2. Couple of minor enhancements/fixing issues required to this > >> utility: > >> > > a. Multiple POJO support is not required. Hence will stick to > >> single > >> > > POJO. > >> > > b. PojoUtils does not work well with resolution of getter > methods > >> > when > >> > > more than one fields are mentioned in expression. Will need to fix > >> that. > >> > > c. Following interface can be added to PojoUtils. This will be > the > >> > > return method that can be called for executing the expression > >> > > interface Expression > >> > > { > >> > > O execute(Object obj); > >> > > } > >> > > d. Following methods can be added to PojoUtils for addressing > >> > > expression support: > >> > > // Evaluates given expression > >> > > Expression evaluateExpression(String expr, Class > >> inputObjectType, > >> > > Class returnType); > >> > > > >> > > // Adds a custom method that can be used in an expression. > >> > > // The one who's using this library can utility this method > to > >> > > provide predefined functionality to user. > >> > > void registerCustomMethod(String qualifiedFunc) > >> > > > >> > > > >> > > Please share your valuable inputs on this. > >> > > > >> > > Thanks, > >> > > Chinmay. > >> > > > >> > > >> > > > > > --047d7bb04c4241caa7052d8894ca--