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 void
close()
Closes this stream and releases any system resources associated with it.org.apache.spark.sql.catalyst.InternalRow
get()
Return the current record.boolean
next()
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 fromBsonDocument
toInternalRow
readConfig
- 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:
next
in 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:
get
in 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:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
-