Class PartitionerHelper


  • public final class PartitionerHelper
    extends java.lang.Object
    Partitioner helper class, contains various utility methods used by the partitioner instances.
    • 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 query
      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.
      static MongoInputPartition[] generatePartitions​(ReadConfig readConfig)  
      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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SINGLE_PARTITIONER

        public static final Partitioner SINGLE_PARTITIONER
    • Method Detail

      • generatePartitions

        public static MongoInputPartition[] generatePartitions​(ReadConfig readConfig)
        Parameters:
        readConfig - the read config
        Returns:
        the partitioner class name
      • 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 query

        Note: 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 bound
        upper - 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 bounds
        userPipeline - 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