Class MongoStreamPartitionReader
- java.lang.Object
-
- com.mongodb.spark.sql.connector.read.MongoStreamPartitionReader
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,PartitionReader<org.apache.spark.sql.catalyst.InternalRow>,ContinuousPartitionReader<org.apache.spark.sql.catalyst.InternalRow>
public class MongoStreamPartitionReader extends java.lang.Object implements ContinuousPartitionReader<org.apache.spark.sql.catalyst.InternalRow>
A partition reader returned byMongoStreamPartitionReaderFactory.createReader(org.apache.spark.sql.connector.read.InputPartition).Utilizes MongoDBs change stream functionality, the continuous stream will consist of change events.
-
-
Constructor Summary
Constructors Constructor Description MongoStreamPartitionReader(MongoInputPartition partition, BsonDocumentToRowConverter bsonDocumentToRowConverter, ReadConfig readConfig)Construct a new instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()org.apache.spark.sql.catalyst.InternalRowget()PartitionOffsetgetOffset()booleannext()
-
-
-
Constructor Detail
-
MongoStreamPartitionReader
public MongoStreamPartitionReader(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
-
getOffset
public PartitionOffset getOffset()
- Specified by:
getOffsetin interfaceContinuousPartitionReader<org.apache.spark.sql.catalyst.InternalRow>
-
next
public boolean next()
- Specified by:
nextin interfacePartitionReader<org.apache.spark.sql.catalyst.InternalRow>
-
get
public org.apache.spark.sql.catalyst.InternalRow get()
- Specified by:
getin interfacePartitionReader<org.apache.spark.sql.catalyst.InternalRow>
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
-