Class MongoPartitionReader
- java.lang.Object
-
- com.mongodb.spark.sql.connector.read.MongoPartitionReader
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,PartitionReader<org.apache.spark.sql.catalyst.InternalRow>
public class MongoPartitionReader extends java.lang.Object implements PartitionReader<org.apache.spark.sql.catalyst.InternalRow>
A partition reader returned byMongoPartitionReaderFactory.createReader(org.apache.spark.sql.connector.read.InputPartition). It's responsible for outputting data for a RDD partition.
-
-
Constructor Summary
Constructors Constructor Description MongoPartitionReader(MongoInputPartition partition, BsonDocumentToRowConverter bsonDocumentToRowConverter, ReadConfig readConfig)Construct a new instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this stream and releases any system resources associated with it.org.apache.spark.sql.catalyst.InternalRowget()Return the current record.booleannext()Proceed to next record, returns false if there is no more records.
-
-
-
Constructor Detail
-
MongoPartitionReader
public MongoPartitionReader(MongoInputPartition partition, BsonDocumentToRowConverter bsonDocumentToRowConverter, ReadConfig readConfig)
Construct a new instance- Parameters:
partition- the partitionbsonDocumentToRowConverter- the converter fromBsonDocumenttoInternalRowreadConfig- the read configuration for reading from the partition
-
-
Method Detail
-
next
public boolean next()
Proceed to next record, returns false if there is no more records.- Specified by:
nextin interfacePartitionReader<org.apache.spark.sql.catalyst.InternalRow>
-
get
public org.apache.spark.sql.catalyst.InternalRow get()
Return the current record. This method should return same value until `next` is called.- Specified by:
getin interfacePartitionReader<org.apache.spark.sql.catalyst.InternalRow>
-
close
public void close()
Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
-