Class PartitionerHelper
- java.lang.Object
-
- com.mongodb.spark.sql.connector.read.partitioner.PartitionerHelper
-
public final class PartitionerHelper extends java.lang.Object
Partitioner helper class, contains various utility methods used by the partitioner instances.
-
-
Field Summary
Fields Modifier and Type Field Description static Partitioner
SINGLE_PARTITIONER
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.bson.BsonDocument
createPartitionBounds(org.bson.BsonValue lower, org.bson.BsonValue upper)
Creates the upper and lower boundary querystatic java.util.List<org.bson.BsonDocument>
createPartitionPipeline(org.bson.BsonDocument partitionBounds, java.util.List<org.bson.BsonDocument> userPipeline)
Creates the aggregation pipeline for a partition.static java.util.List<java.lang.String>
getPreferredLocations(ReadConfig readConfig)
static org.bson.BsonDocument
matchQuery(java.util.List<org.bson.BsonDocument> userPipeline)
Returns the head$match
aggregation stage or an empty document.static org.bson.BsonDocument
storageStats(ReadConfig readConfig)
-
-
-
Field Detail
-
SINGLE_PARTITIONER
public static final Partitioner SINGLE_PARTITIONER
-
-
Method Detail
-
matchQuery
public static org.bson.BsonDocument matchQuery(java.util.List<org.bson.BsonDocument> userPipeline)
Returns the head$match
aggregation stage or an empty document.- Parameters:
userPipeline
- configured aggregation pipeline- Returns:
- the head
$match
aggregation stage or an empty document.
-
createPartitionBounds
public static org.bson.BsonDocument createPartitionBounds(org.bson.BsonValue lower, org.bson.BsonValue upper)
Creates the upper and lower boundary queryNote: does not include min and max key values in the boundary as these are implicit bounds, so not required.
- Parameters:
lower
- the value of the lower boundupper
- the value of the upper bound- Returns:
- the document containing the partition bounds
-
createPartitionPipeline
public static java.util.List<org.bson.BsonDocument> createPartitionPipeline(org.bson.BsonDocument partitionBounds, java.util.List<org.bson.BsonDocument> userPipeline)
Creates the aggregation pipeline for a partition.- Parameters:
partitionBounds
- a document representing the partition boundsuserPipeline
- the user supplied pipeline- Returns:
- the aggregation pipeline for a partition
-
storageStats
public static org.bson.BsonDocument storageStats(ReadConfig readConfig)
- Parameters:
readConfig
- the read config- Returns:
- the storage stats or an empty document if the collection does not exist
-
getPreferredLocations
public static java.util.List<java.lang.String> getPreferredLocations(ReadConfig readConfig)
- Parameters:
readConfig
- the read config- Returns:
- the list of mongodb hosts
-
-