Return-Path: X-Original-To: apmail-spark-user-archive@minotaur.apache.org Delivered-To: apmail-spark-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 C128E10A75 for ; Fri, 23 Jan 2015 09:25:53 +0000 (UTC) Received: (qmail 8212 invoked by uid 500); 23 Jan 2015 09:25:50 -0000 Delivered-To: apmail-spark-user-archive@spark.apache.org Received: (qmail 8133 invoked by uid 500); 23 Jan 2015 09:25:50 -0000 Mailing-List: contact user-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list user@spark.apache.org Received: (qmail 8123 invoked by uid 99); 23 Jan 2015 09:25:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Jan 2015 09:25:50 +0000 X-ASF-Spam-Status: No, hits=2.8 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of phatak.dev@gmail.com designates 209.85.216.48 as permitted sender) Received: from [209.85.216.48] (HELO mail-qa0-f48.google.com) (209.85.216.48) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Jan 2015 09:25:20 +0000 Received: by mail-qa0-f48.google.com with SMTP id v8so4955288qal.7 for ; Fri, 23 Jan 2015 01:23:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ufZNaMV+2klc3iMJ25g9LtAnrHEW2VpYTcY8L/5uL3Y=; b=iFtwCnk0CJgROyc4dyl7ENm3eBAlomtR5ABFQynRfHTEDF0NkRQZLCwi7SXaZtmsHO PaUPIuRA4A2N7lSqGotNGa6GqgsZs30EPWNKklXIJ7A/1VbUR4/mwlPFKrcR0BShXjSV HR8Tf6JW5OoVDNXS44I607CKClcRv75+D5u9x0R2mAJPYht+xpK5oUc/KUR+fdvzWlPT hgLoj/ymzMEb9qQgh5r+utX1XqAxoiOHpGca8o8Xg1M7INESHJxcGLFriLLM3BDhFEUP 8utYIar8Uf3xzWaa4M/05rpH98wk87TZHVdFxjrCRKHNd7NtnaAEkzGHarEr8yeYAXOh 0SEQ== MIME-Version: 1.0 X-Received: by 10.140.33.162 with SMTP id j31mr11744682qgj.10.1422005028648; Fri, 23 Jan 2015 01:23:48 -0800 (PST) Received: by 10.229.157.17 with HTTP; Fri, 23 Jan 2015 01:23:48 -0800 (PST) In-Reply-To: <1421971644455-21324.post@n3.nabble.com> References: <1421971644455-21324.post@n3.nabble.com> Date: Fri, 23 Jan 2015 14:53:48 +0530 Message-ID: Subject: Re: save a histogram to a file From: madhu phatak To: SK Cc: "user@spark.apache.org" Content-Type: multipart/alternative; boundary=001a113ab98899fc21050d4e58a6 X-Virus-Checked: Checked by ClamAV on apache.org --001a113ab98899fc21050d4e58a6 Content-Type: text/plain; charset=UTF-8 Hi, histogram method return normal scala types not a RDD. So you will not have saveAsTextFile. You can use makeRDD method make a rdd out of the data and saveAsObject file val hist = a.histogram(10) val histRDD = sc.makeRDD(hist) histRDD.saveAsObjectFile(path) On Fri, Jan 23, 2015 at 5:37 AM, SK wrote: > Hi, > histogram() returns an object that is a pair of Arrays. There appears to > be > no saveAsTextFile() for this paired object. > > Currently I am using the following to save the output to a file: > > val hist = a.histogram(10) > > val arr1 = sc.parallelize(hist._1).saveAsTextFile("file1") > val arr2 = sc.parallelize(hist._2).saveAsTextFile("file2") > > Is there a simpler way to save the histogram() result to a file? > > thanks > > > > -- > View this message in context: > http://apache-spark-user-list.1001560.n3.nabble.com/save-a-histogram-to-a-file-tp21324.html > Sent from the Apache Spark User List mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@spark.apache.org > For additional commands, e-mail: user-help@spark.apache.org > > -- Regards, Madhukara Phatak http://www.madhukaraphatak.com --001a113ab98899fc21050d4e58a6 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,
histogram method return normal scala types not a R= DD. So you will not have=C2=A0saveAsTextFile= . You can use makeRDD method make a rdd out of the data and saveAsObject fi= le

val hist = =3D a.histogram(10)
val histRDD =3D sc.makeRDD(hist)
histRDD.saveAsObjectFile(path)


On Fri, Jan 23, 2015 at 5:37 AM, SK <= span dir=3D"ltr"><skrishna.id@gmail.com> wrote:
Hi,
histogram() returns an object that is a=C2=A0 pair of Arrays. There appears= to be
no saveAsTextFile() for this paired object.

Currently I am using the following to save the output to a file:

val hist =3D a.histogram(10)

val arr1 =3D sc.parallelize(hist._1).saveAsTextFile("file1")
val arr2 =3D sc.parallelize(hist._2).saveAsTextFile("file2")

Is there a simpler way to save the histogram() result to a file?

thanks



--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/save-a-histogram-to-a= -file-tp21324.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org




--
Regards,
Madhukara Pha= tak
--001a113ab98899fc21050d4e58a6--