Return-Path: X-Original-To: apmail-incubator-crunch-user-archive@minotaur.apache.org Delivered-To: apmail-incubator-crunch-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 308CCEA9F for ; Thu, 14 Feb 2013 14:18:57 +0000 (UTC) Received: (qmail 17284 invoked by uid 500); 14 Feb 2013 14:18:57 -0000 Delivered-To: apmail-incubator-crunch-user-archive@incubator.apache.org Received: (qmail 17128 invoked by uid 500); 14 Feb 2013 14:18:54 -0000 Mailing-List: contact crunch-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: crunch-user@incubator.apache.org Delivered-To: mailing list crunch-user@incubator.apache.org Received: (qmail 17108 invoked by uid 99); 14 Feb 2013 14:18:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Feb 2013 14:18:53 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of josh.wills@gmail.com designates 209.85.217.174 as permitted sender) Received: from [209.85.217.174] (HELO mail-lb0-f174.google.com) (209.85.217.174) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Feb 2013 14:18:47 +0000 Received: by mail-lb0-f174.google.com with SMTP id l12so1804508lbo.5 for ; Thu, 14 Feb 2013 06:18:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=rhlk881Qg2n3eAzZt2pH1G9/6joCHdWtVmtacBRmzuI=; b=1J92AJjnVSSWvUOJlUkospS9XegY0L5yE/7+OSRLKdFLhNz6usMrJtR6lCQ0V5Ugnp 1jFAm4fXZhfO/iHjNAV9vXlhtRtT3Ikpk/PxI188Bs51nUf9jrGEm2tepwLbYFZad+ZC IvtEw5fm6nsA4ayP6PQQthHIJNm4bGNhC3kEVqLtDaK+7ttOiUBtf5jYsFhko7pf0zKf WD30mLSWETwm17Yf30ypaTvcH5XpRnvDFdXlSrYQEr2VuRGpup+m/a/6kDCjsRVFWUMr rcBwVsj19raPA5lvDiPIf1x6Ben94k/3WpsBkbLuhFZFVXYqWRibzJCFTM+Rt+EUrgf5 umlg== X-Received: by 10.112.51.233 with SMTP id n9mr705358lbo.47.1360851505877; Thu, 14 Feb 2013 06:18:25 -0800 (PST) MIME-Version: 1.0 Received: by 10.112.14.71 with HTTP; Thu, 14 Feb 2013 06:18:05 -0800 (PST) In-Reply-To: References: From: Josh Wills Date: Thu, 14 Feb 2013 06:18:05 -0800 Message-ID: Subject: Re: [Scrunch] implicit PTypeH value on parallelDo method To: "crunch-user@incubator.apache.org" Content-Type: multipart/alternative; boundary=f46d0401f97f99953f04d5afeede X-Virus-Checked: Checked by ClamAV on apache.org --f46d0401f97f99953f04d5afeede Content-Type: text/plain; charset=ISO-8859-1 IIRC, I couldn't put implicits on parallelDo b/c I couldn't figure out how to make it distinguish between when it should return a PCollection vs. a PTable. If you look at the code for (say) the map function in PCollection.scala, you see that it looks like: def map[T, To](f: S => T)(implicit pt: PTypeH[T], b: CanParallelTransform[T, To]): To = { b(this, mapFn(f), pt.get(getTypeFamily())) } where the CanParallelTransform implicit type figures out whether or not it should return a PCollection or a PTable based on the return type of the map fn, which is, to be sure, really frickin' cool. If you're interested in trying it out w/the parallelDo in PCollectionLike, I'd be curious to know if it works, either in the current version or a later version of Scala (2.9.2/2.10). I'll be spending more time on Scrunch in our next release (0.6.0 timeframe), and I'm always glad to have folks who want to improve it around to help out. J On Thu, Feb 14, 2013 at 2:29 AM, Lionel Herbet wrote: > Hi, > > I'm currently testing scrunch after few MR Job implementation on crunch. > I was wondering if it would be possible to have implicit PTypeH parameter > in PcollectionLike scala trait methods ? > PCollection scala class already has implicit PtypeH parameter for map > method. > > For example in PcollectionLike scala Trait we could add the method > > def parallelDo[T](fn: DoFn[S, T])(implicit pt: PTypeH[T]) = { > new PCollection[T](native.parallelDo(fn, pt.get(getTypeFamily()))) > } > > This method is equivalent to the existing one but with an implicit value > for PTypeH depending on [T] class type. > > def parallelDo[T](fn: DoFn[S, T], ptype: PType[T]) = { > new PCollection[T](native.parallelDo(fn, ptype)) > } > > What do you think ? > > Lionel > > --f46d0401f97f99953f04d5afeede Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
IIRC, I couldn't put implicits on parallelDo b/c I cou= ldn't figure out how to make it distinguish between when it should retu= rn a PCollection vs. a PTable. If you look at the code for (say) the map fu= nction in PCollection.scala, you see that it looks like:

=A0 def map[T, To](f: S =3D> T)(implicit pt: PTypeH[= T], b: CanParallelTransform[T, To]): To =3D {
=A0 =A0 b(this, map= Fn(f), pt.get(getTypeFamily()))
=A0 }

<= div>where the CanParallelTransform implicit type figures out whether or not= it should return a PCollection or a PTable based on the return type of the= map fn, which is, to be sure, really frickin' cool. If you're inte= rested in trying it out w/the parallelDo in PCollectionLike, I'd be cur= ious to know if it works, either in the current version or a later version = of Scala (2.9.2/2.10).

I'll be spending more time on Scrunch in our next r= elease (0.6.0 timeframe), and I'm always glad to have folks who want to= improve it around to help out.

J


On Thu, Feb 14, 2013 at 2:29 AM, Lionel = Herbet <lionel.herbet@gmail.com> wrote:
Hi,

I'm currently testing scrunch after few MR Job implementation on crunch=
.
I was wondering if it would be possible to have implicit PTypeH parameter
in PcollectionLike scala trait methods ?
PCollection scala class already has implicit PtypeH parameter for map
method.

For example in PcollectionLike scala Trait we could add the method

def parallelDo[T](fn: DoFn[S, T])(implicit pt: PTypeH[T]) =3D {
        new PCollection[T](native.parallelDo(fn, pt.get(getTypeFamily())))
    }

This method is equivalent to the existing one but with an implicit value
for PTypeH depending on [T] class type.

def parallelDo[T](fn: DoFn[S, T], ptype: PType[T]) =3D {
    new PCollection[T](native.parallelDo(fn, ptype))
  }

What do you think ?

Lionel
=

--f46d0401f97f99953f04d5afeede--