use of org.bson.LazyBSONDecoder in project mongo-hadoop by mongodb.
the class BSONFileRecordReader method init.
public void init(final InputSplit inputSplit, final Configuration configuration) throws IOException, InterruptedException {
this.configuration = configuration;
fileSplit = (FileSplit) inputSplit;
if (LOG.isDebugEnabled()) {
LOG.debug("reading split " + fileSplit);
}
Path file = fileSplit.getPath();
FileSystem fs = file.getFileSystem(configuration);
CompressionCodec codec = new CompressionCodecFactory(configuration).getCodec(fileSplit.getPath());
inRaw = fs.open(file, 16 * 1024 * 1024);
inRaw.seek(startingPosition == BSON_RR_POSITION_NOT_GIVEN ? fileSplit.getStart() : startingPosition);
if (codec != null) {
decompressor = CodecPool.getDecompressor(codec);
in = codec.createInputStream(inRaw, decompressor);
} else {
in = inRaw;
}
if (MongoConfigUtil.getLazyBSON(configuration)) {
callback = new LazyBSONCallback();
decoder = new LazyBSONDecoder();
} else {
callback = new BasicBSONCallback();
decoder = new BasicBSONDecoder();
}
}
Aggregations