It ia a transformations that sorts the RDD by the function that we define based of key() which is provided as an argument. For example.
SortBy( func, ascending=True, numPartitions=None)
1) func --> It is a function that is used to compute the sort key for each element. 2) ascending -- It is a flag to indicate whether the sorting is ascending or descending. 3) numPartions :- Total Number of partitions you want to create.
Example :-
var tmp =List( ("a":1), ("b":2), ("1":3), ("d":4), "2":5) var rdd = sc.parallelize (tmp) 1) rdd.sortBY(x=>x._1).collect() -----> This will do sorting based on the x.-1(first element). --> x._1 is used to access the first element in the scala. Hope you remember. 2) rdd.sortBY(x=>x._2) .collect() ---> w.r.t second element. 3) rdd.sortBy(x=>x).collect() ---> sorting w.r.t to the values of the inputs list.
Kindly run this and you will come to know, it is clearly given in the tutorial.
This automatic reply is just to let you know that we received your message and we’ll get back to you with a response as quickly as possible. During business hours (9am-5pm IST, Monday-Friday) we do our best to reply within a few hours. Evenings and weekends may take us a little bit longer.
If you have a general question about using CloudxLab, you’re welcome to browse our below Knowledge Base for walkthroughs of all of our features and answers to frequently asked questions.
If you have any additional information that you think will help us to assist you, please feel free to reply to this email. We look forward to chatting soon!
Please login to comment
16 Comments
Unable to download the last set of slides, please help.
Upvote ShareHi Manjari,
It is downloadable now.
Upvote ShareUnable to download the last slide. Kindly help.
2 Upvote ShareHi Dilip,
It is downloadable now.
Upvote ShareThanks for your prompt reply after 3 months.
Upvote ShareHow to download the last slide? Kindly help.
Upvote ShareHi Shailesh,
It is downloadable now.
Upvote Sharewhere can we get the last set of slides?
Upvote ShareHi, Vicky.
At the end of every section, you will be able to download the slide by maximising the slide.
All the best.
Upvote ShareI didn't get how sortBy and other transformations functions executes ???
Upvote ShareHi, Vaibhav.
It ia a transformations that sorts the RDD by the function that we define based of key() which is provided as an argument.
For example.
SortBy( func, ascending=True, numPartitions=None)
1) func --> It is a function that is used to compute the sort key for each element.
2) ascending -- It is a flag to indicate whether the sorting is ascending or descending.
3) numPartions :- Total Number of partitions you want to create.
Example :-
var tmp =List( ("a":1), ("b":2), ("1":3), ("d":4), "2":5)
var rdd = sc.parallelize (tmp)
1) rdd.sortBY(x=>x._1).collect() -----> This will do sorting based on the x.-1(first element). --> x._1 is used to access the first element in the scala. Hope you remember.
2) rdd.sortBY(x=>x._2) .collect() ---> w.r.t second element.
3) rdd.sortBy(x=>x).collect() ---> sorting w.r.t to the values of the inputs list.
Kindly run this and you will come to know, it is clearly given in the tutorial.
All the best!
-- Satyajit Das
Upvote Shareis there a way I can download the last google slides? - Basics of RDD more operations
Upvote ShareHello Disqus,
Thanks for contacting CloudxLab!
This automatic reply is just to let you know that we received your message and we’ll get back to you with a response as quickly as possible. During business hours (9am-5pm IST, Monday-Friday) we do our best to reply within a few hours. Evenings and weekends may take us a little bit longer.
If you have a general question about using CloudxLab, you’re welcome to browse our below Knowledge Base for walkthroughs of all of our features and answers to frequently asked questions.
- Tech FAQ <https: cloudxlab.com="" faq="" support="">
- General FAQ <https: cloudxlab.com="" faq=""/>
If you have any additional information that you think will help us to assist you, please feel free to reply to this email. We look forward to chatting soon!
Cheers,
Upvote ShareThe CloudxLab Team
How to download the pdf of Basics of RDD - More Operations?
Upvote ShareHow can I download the last google slides? - Basics of RDD more operations
Upvote ShareHow to download the pdf of Basics of RDD - More Operations.
Upvote Share