spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hafiz Mujadid <hafizmujadi...@gmail.com>
Subject Re: Inserting an element in RDD[String]
Date Thu, 15 Jan 2015 15:46:02 GMT
thanks

On Thu, Jan 15, 2015 at 7:35 PM, Prannoy [via Apache Spark User List] <
ml-node+s1001560n21163h62@n3.nabble.com> wrote:

> Hi,
>
> You can take the schema line in another rdd and than do a union of the two
> rdd .
>
> List<String> schemaList = new ArrayList<String>;
> schemaList.add("xyz");
>
> // where xyz is your schema line
>
> JavaRDD schemaRDD<String> = sc.parallize(schemaList) ;
>
> //where sc is your sparkcontext
>
>  JavaRDD newRDD<String> = schemaRDD.union(yourRDD);
>
> // where yourRDD is your another rdd starting of which you want to add the
> schema line.
>
> <The code is in java, you can change it to scala >
>
> Thanks.
>
>
>
>
>
> On Thu, Jan 15, 2015 at 7:46 PM, Hafiz Mujadid [via Apache Spark User
> List] <[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=21163&i=0>> wrote:
>
>> hi experts!
>>
>> I hav an RDD[String] and i want to add schema line at beginning in this
>> rdd. I know RDD is immutable. So is there anyway to have a new rdd with one
>> schema line and contents of previous rdd?
>>
>>
>> Thanks
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the
>> discussion below:
>>
>> http://apache-spark-user-list.1001560.n3.nabble.com/Inserting-an-element-in-RDD-String-tp21161.html
>>  To start a new topic under Apache Spark User List, email [hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=21163&i=1>
>> To unsubscribe from Apache Spark User List, click here.
>> NAML
>> <http://apache-spark-user-list.1001560.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://apache-spark-user-list.1001560.n3.nabble.com/Inserting-an-element-in-RDD-String-tp21161p21163.html
>  To unsubscribe from Inserting an element in RDD[String], click here
> <http://apache-spark-user-list.1001560.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=21161&code=aGFmaXptdWphZGlkMDBAZ21haWwuY29tfDIxMTYxfC05MjEzOTMxMTE=>
> .
> NAML
> <http://apache-spark-user-list.1001560.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>



-- 
Regards: HAFIZ MUJADID




--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Inserting-an-element-in-RDD-String-tp21161p21165.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.
Mime
View raw message