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 void
close()
org.apache.spark.sql.catalyst.InternalRow
get()
PartitionOffset
getOffset()
boolean
next()
-
-
-
Constructor Detail
-
MongoStreamPartitionReader
public MongoStreamPartitionReader(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
-
getOffset
public PartitionOffset getOffset()
- Specified by:
getOffset
in interfaceContinuousPartitionReader<org.apache.spark.sql.catalyst.InternalRow>
-
next
public boolean next()
- Specified by:
next
in interfacePartitionReader<org.apache.spark.sql.catalyst.InternalRow>
-
get
public org.apache.spark.sql.catalyst.InternalRow get()
- Specified by:
get
in interfacePartitionReader<org.apache.spark.sql.catalyst.InternalRow>
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
-