You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Vladimir Protsenko <pr...@gmail.com> on 2015/02/12 16:36:27 UTC

saveAsHadoopFile is not a member of ... RDD[(String, MyObject)]

Hi. I am stuck with how to save file to hdfs from spark. 

I have written MyOutputFormat extends FileOutputFormat<String, MyObject>,
then in spark calling this:

  rddres.saveAsHadoopFile[MyOutputFormat]("hdfs://localhost/output") or
  rddres.saveAsHadoopFile("hdfs://localhost/output", classOf[String],
classOf[MyObject], 
                                   classOf[MyOutputFormat])

where rddres is RDD[(String, MyObject)] from up of transformation pipeline.

Compilation error is: /value saveAsHadoopFile is not a member of
org.apache.spark.rdd.RDD[(String, vlpr.MyObject)]/. 

Could someone give me insights on what could be done here to make it
working? Why it is not a member? Because of wrong types?



--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/saveAsHadoopFile-is-not-a-member-of-RDD-String-MyObject-tp21627.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


Re: saveAsHadoopFile is not a member of ... RDD[(String, MyObject)]

Posted by Vladimir Protsenko <pr...@gmail.com>.
Thank you. That worked.

2015-02-12 20:03 GMT+04:00 Imran Rashid <ir...@cloudera.com>:

> You need to import the implicit conversions to PairRDDFunctions with
>
> import org.apache.spark.SparkContext._
>
> (note that this requirement will go away in 1.3:
> https://issues.apache.org/jira/browse/SPARK-4397)
>
> On Thu, Feb 12, 2015 at 9:36 AM, Vladimir Protsenko <protsenkovi@gmail.com
> > wrote:
>
>> Hi. I am stuck with how to save file to hdfs from spark.
>>
>> I have written MyOutputFormat extends FileOutputFormat<String, MyObject>,
>> then in spark calling this:
>>
>>   rddres.saveAsHadoopFile[MyOutputFormat]("hdfs://localhost/output") or
>>   rddres.saveAsHadoopFile("hdfs://localhost/output", classOf[String],
>> classOf[MyObject],
>>                                    classOf[MyOutputFormat])
>>
>> where rddres is RDD[(String, MyObject)] from up of transformation
>> pipeline.
>>
>> Compilation error is: /value saveAsHadoopFile is not a member of
>> org.apache.spark.rdd.RDD[(String, vlpr.MyObject)]/.
>>
>> Could someone give me insights on what could be done here to make it
>> working? Why it is not a member? Because of wrong types?
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-spark-user-list.1001560.n3.nabble.com/saveAsHadoopFile-is-not-a-member-of-RDD-String-MyObject-tp21627.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
>>
>>
>

Re: saveAsHadoopFile is not a member of ... RDD[(String, MyObject)]

Posted by Imran Rashid <ir...@cloudera.com>.
You need to import the implicit conversions to PairRDDFunctions with

import org.apache.spark.SparkContext._

(note that this requirement will go away in 1.3:
https://issues.apache.org/jira/browse/SPARK-4397)

On Thu, Feb 12, 2015 at 9:36 AM, Vladimir Protsenko <pr...@gmail.com>
wrote:

> Hi. I am stuck with how to save file to hdfs from spark.
>
> I have written MyOutputFormat extends FileOutputFormat<String, MyObject>,
> then in spark calling this:
>
>   rddres.saveAsHadoopFile[MyOutputFormat]("hdfs://localhost/output") or
>   rddres.saveAsHadoopFile("hdfs://localhost/output", classOf[String],
> classOf[MyObject],
>                                    classOf[MyOutputFormat])
>
> where rddres is RDD[(String, MyObject)] from up of transformation pipeline.
>
> Compilation error is: /value saveAsHadoopFile is not a member of
> org.apache.spark.rdd.RDD[(String, vlpr.MyObject)]/.
>
> Could someone give me insights on what could be done here to make it
> working? Why it is not a member? Because of wrong types?
>
>
>
> --
> View this message in context:
> http://apache-spark-user-list.1001560.n3.nabble.com/saveAsHadoopFile-is-not-a-member-of-RDD-String-MyObject-tp21627.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
>
>

Re: saveAsHadoopFile is not a member of ... RDD[(String, MyObject)]

Posted by Vladimir Protsenko <pr...@gmail.com>.
Thank you for clarification, Sean.

2015-02-13 14:16 GMT+04:00 Sean Owen <so...@cloudera.com>:

> It is a wrapper whose API is logically the same, but whose method
> signature make more sense in Java. You can call the Scala API in Java
> without too much trouble, but it gets messy when you have to manually
> grapple with ClassTag from Java for example.
>
> There is not an implicit conversion since it is used from Java, which
> doesn't have implicits.
>
> On Fri, Feb 13, 2015 at 5:57 AM, Vladimir Protsenko
> <pr...@gmail.com> wrote:
> > Thank's for reply. I solved porblem with importing
> > org.apache.spark.SparkContext._ by Imran Rashid suggestion.
> >
> > In the sake of interest, does JavaPairRDD intended for use from java?
> What
> > is the purpose of this class? Does my rdd implicitly converted to it in
> some
> > circumstances?
>

Re: saveAsHadoopFile is not a member of ... RDD[(String, MyObject)]

Posted by Sean Owen <so...@cloudera.com>.
It is a wrapper whose API is logically the same, but whose method
signature make more sense in Java. You can call the Scala API in Java
without too much trouble, but it gets messy when you have to manually
grapple with ClassTag from Java for example.

There is not an implicit conversion since it is used from Java, which
doesn't have implicits.

On Fri, Feb 13, 2015 at 5:57 AM, Vladimir Protsenko
<pr...@gmail.com> wrote:
> Thank's for reply. I solved porblem with importing
> org.apache.spark.SparkContext._ by Imran Rashid suggestion.
>
> In the sake of interest, does JavaPairRDD intended for use from java? What
> is the purpose of this class? Does my rdd implicitly converted to it in some
> circumstances?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org


Re: saveAsHadoopFile is not a member of ... RDD[(String, MyObject)]

Posted by Vladimir Protsenko <pr...@gmail.com>.
Thank's for reply. I solved porblem with importing
org.apache.spark.SparkContext._ by Imran Rashid suggestion.

In the sake of interest, does JavaPairRDD intended for use from java? What
is the purpose of this class? Does my rdd implicitly converted to it in
some circumstances?

2015-02-12 19:42 GMT+04:00 Ted Yu <yu...@gmail.com>:

> You can use JavaPairRDD which has:
>
>   override def wrapRDD(rdd: RDD[(K, V)]): JavaPairRDD[K, V] =
> JavaPairRDD.fromRDD(rdd)
>
> Cheers
>
> On Thu, Feb 12, 2015 at 7:36 AM, Vladimir Protsenko <protsenkovi@gmail.com
> > wrote:
>
>> Hi. I am stuck with how to save file to hdfs from spark.
>>
>> I have written MyOutputFormat extends FileOutputFormat<String, MyObject>,
>> then in spark calling this:
>>
>>   rddres.saveAsHadoopFile[MyOutputFormat]("hdfs://localhost/output") or
>>   rddres.saveAsHadoopFile("hdfs://localhost/output", classOf[String],
>> classOf[MyObject],
>>                                    classOf[MyOutputFormat])
>>
>> where rddres is RDD[(String, MyObject)] from up of transformation
>> pipeline.
>>
>> Compilation error is: /value saveAsHadoopFile is not a member of
>> org.apache.spark.rdd.RDD[(String, vlpr.MyObject)]/.
>>
>> Could someone give me insights on what could be done here to make it
>> working? Why it is not a member? Because of wrong types?
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-spark-user-list.1001560.n3.nabble.com/saveAsHadoopFile-is-not-a-member-of-RDD-String-MyObject-tp21627.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
>>
>>
>

Re: saveAsHadoopFile is not a member of ... RDD[(String, MyObject)]

Posted by Ted Yu <yu...@gmail.com>.
You can use JavaPairRDD which has:

  override def wrapRDD(rdd: RDD[(K, V)]): JavaPairRDD[K, V] =
JavaPairRDD.fromRDD(rdd)

Cheers

On Thu, Feb 12, 2015 at 7:36 AM, Vladimir Protsenko <pr...@gmail.com>
wrote:

> Hi. I am stuck with how to save file to hdfs from spark.
>
> I have written MyOutputFormat extends FileOutputFormat<String, MyObject>,
> then in spark calling this:
>
>   rddres.saveAsHadoopFile[MyOutputFormat]("hdfs://localhost/output") or
>   rddres.saveAsHadoopFile("hdfs://localhost/output", classOf[String],
> classOf[MyObject],
>                                    classOf[MyOutputFormat])
>
> where rddres is RDD[(String, MyObject)] from up of transformation pipeline.
>
> Compilation error is: /value saveAsHadoopFile is not a member of
> org.apache.spark.rdd.RDD[(String, vlpr.MyObject)]/.
>
> Could someone give me insights on what could be done here to make it
> working? Why it is not a member? Because of wrong types?
>
>
>
> --
> View this message in context:
> http://apache-spark-user-list.1001560.n3.nabble.com/saveAsHadoopFile-is-not-a-member-of-RDD-String-MyObject-tp21627.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
>
>