I'm building an inverted index and currently getting a null pointer exception in reduce when using context.write. Can anyone spot why? I presume something to do with serialising as I've never done that before? The error also happens when I print out h.
Two things that I can spot directly regarding the serialization without a stacktrace:
ArrayListWritable
correctly (not null and it needs the setClass
method to deserialize correctly. Turns out it was because I had iterated over the data set twice (the line int df = Iterables.size(values);
tricked me). The iterator hadn't reset hence the main block of reduce didnt run and finally I hit a null pointer because I tried accessing my data that hadn't even initialised.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.