Language:EN
Pages: 2
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Page 1 Preview
using the java interface for java serialization

Using the java interface for java serialization

implementing your own serialization routines for your data types (e.g., using the java.io.Externalizable interface for Java Serialization, or using the reduce() method to define custom serialization for Python’s pickle library).

Working on a Per-Partition Basis

deffetchCallSigns(input):
"""Fetch call signs"""
returninput.mapPartitions(lambdacallSigns:processCallSigns(callSigns))

contactsContactList=fetchCallSigns(validSigns)

Working on a Per-Partition Basis | 107

// Use mapPartitions to reuse setup work.

JavaPairRDD<String,CallLog[]>contactsContactLists=
validCallSigns.mapPartitionsToPair(
newPairFlatMapFunction<Iterator<String>,String,CallLog[]>(){
publicIterable<Tuple2<String,CallLog[]>>call(Iterator<String>input){ // List for our results.

We are called with

We return

Function signature on RDD[T]
Iterator of the elements in
f: (Iterator[T]) →
that partition return elements

Integer of partition number,

Iterator of our

return elements
that partition

tor[U]

108 |

Chapter 6: Advanced Spark Programming

You are viewing 1/3rd of the document.Purchase the document to get full access instantly

Immediately available after payment
Both online and downloadable
No strings attached
How It Works
Login account
Login Your Account
Place in cart
Add to Cart
send in the money
Make payment
Document download
Download File
img

Uploaded by : James Schneider

PageId: ELI48B6FCC