Cloudera
CCD-410 · Question #20
In the reducer, the MapReduce API provides you with an iterator over Writable values. What does calling the next () method return?
The correct answer is C. It returns a reference to the same Writable object each time, but populated with different data. Calling Iterator.next() will always return the SAME EXACT instance of IntWritable, with the contents of that instance replaced with the next value.
Developing with Apache Spark Core
Question
In the reducer, the MapReduce API provides you with an iterator over Writable values. What does calling the next () method return?
Options
- AIt returns a reference to a different Writable object time.
- BIt returns a reference to a Writable object from an object pool.
- CIt returns a reference to the same Writable object each time, but populated with different data.
- DIt returns a reference to a Writable object. The API leaves unspecified whether this is a reused object
- EIt returns a reference to the same Writable object if the next value is the same as the previous value,
How the community answered
(22 responses)- A14% (3)
- C73% (16)
- D9% (2)
- E5% (1)
Explanation
Calling Iterator.next() will always return the SAME EXACT instance of IntWritable, with the contents of that instance replaced with the next value.
Topics
#reducer iterator#Writable reuse#next() method#object reference
Community Discussion
No community discussion yet for this question.