Class QueryUtils


  • public final class QueryUtils
    extends Object
    Collection of helper methods which build Documents for use in DocumentDB queries, including: 1. Projections 2. Predicates 3. Queries (a collection of predicates)
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.bson.Document makePredicate​(org.apache.arrow.vector.types.pojo.Field field, ValueSet constraint)
      Converts a single field constraint into a Document for use in a DocumentDB query.
      static org.bson.Document makeProjection​(org.apache.arrow.vector.types.pojo.Schema schema)
      Given a Schema create a projection document which can be used to request only specific Document fields from DocumentDB.
      static org.bson.Document makeQuery​(org.apache.arrow.vector.types.pojo.Schema schema, Map<String,​ValueSet> constraintSummary)
      Given a set of Constraints and the projection Schema, create the Query Document that can be used to push predicates into DocumentDB.
      static org.bson.Document parseFilter​(String filter)
      Parses DocDB/MongoDB Json Filter/Projection to confirm its valid and convert it to Doc
    • Method Detail

      • makeProjection

        public static org.bson.Document makeProjection​(org.apache.arrow.vector.types.pojo.Schema schema)
        Given a Schema create a projection document which can be used to request only specific Document fields from DocumentDB.
        Parameters:
        schema - The schema containing the requested projection.
        Returns:
        A Document matching the requested field projections.
      • makeQuery

        public static org.bson.Document makeQuery​(org.apache.arrow.vector.types.pojo.Schema schema,
                                                  Map<String,​ValueSet> constraintSummary)
        Given a set of Constraints and the projection Schema, create the Query Document that can be used to push predicates into DocumentDB.
        Parameters:
        schema - The schema containing the requested projection.
        constraintSummary - The set of constraints to apply to the query.
        Returns:
        The Document to use as the query.
      • makePredicate

        public static org.bson.Document makePredicate​(org.apache.arrow.vector.types.pojo.Field field,
                                                      ValueSet constraint)
        Converts a single field constraint into a Document for use in a DocumentDB query.
        Parameters:
        field - The field for the given ValueSet constraint.
        constraint - The constraint to apply to the given field.
        Returns:
        A Document describing the constraint for pushing down into DocumentDB.
      • parseFilter

        public static org.bson.Document parseFilter​(String filter)
        Parses DocDB/MongoDB Json Filter/Projection to confirm its valid and convert it to Doc
        Parameters:
        filter - json's based filter
        Returns:
        Document