Class MongoAdapterTest

  • All Implemented Interfaces:
    Direct Known Subclasses:

    public class MongoAdapterTest
    extends java.lang.Object
    implements org.apache.calcite.schema.SchemaFactory
    Testing mongo adapter functionality. By default runs with Fongo unless IT maven profile is enabled (via $ mvn -Pit install).
    See Also:
    • Field Detail

      • MODEL

        protected static final MODEL
        Connection factory based on the "mongo-zips" model.
      • ZIPS_SIZE

        protected static final int ZIPS_SIZE
        Number of records in local file
        See Also:
        Constant Field Values
      • schema

        private static org.apache.calcite.adapter.mongodb.MongoSchema schema
    • Constructor Detail

      • MongoAdapterTest

        public MongoAdapterTest()
    • Method Detail

      • setUp

        public static void setUp()
                          throws java.lang.Exception
      • populate

        private static void populate​(com.mongodb.client.MongoCollection<org.bson.Document> collection,
      • create

        public org.apache.calcite.schema.Schema create​(org.apache.calcite.schema.SchemaPlus parentSchema,
                                                       java.lang.String name,
                                                       java.util.Map<java.lang.String,​java.lang.Object> operand)
        Returns always the same schema to avoid initialization costs.
        Specified by:
        create in interface org.apache.calcite.schema.SchemaFactory
      • testSort

        public void testSort()
      • testSortLimit

        public void testSortLimit()
      • testOffsetLimit

        public void testOffsetLimit()
      • testLimit

        public void testLimit()
      • testFilterSort

        public void testFilterSort()
      • testFilterSortDesc

        public void testFilterSortDesc()
      • testUnionPlan

        public void testUnionPlan()
      • testFilterUnionPlan

        public void testFilterUnionPlan()
      • testFilterRedundant

        public void testFilterRedundant()
        Tests that we don't generate multiple constraints on the same column. MongoDB doesn't like it. If there is an '=', it supersedes all other operators.
      • testSelectWhere

        public void testSelectWhere()
      • testInPlan

        public void testInPlan()
      • testZips

        public void testZips()
        Simple query based on the "mongo-zips" model.
      • testCountGroupByEmpty

        public void testCountGroupByEmpty()
      • testCountGroupByEmptyMultiplyBy2

        public void testCountGroupByEmptyMultiplyBy2()
      • testGroupByOneColumnNotProjected

        public void testGroupByOneColumnNotProjected()
      • testGroupByOneColumn

        public void testGroupByOneColumn()
      • testGroupByOneColumnReversed

        public void testGroupByOneColumnReversed()
      • testGroupByAvg

        public void testGroupByAvg()
      • testGroupByAvgSumCount

        public void testGroupByAvgSumCount()
      • testGroupByHaving

        public void testGroupByHaving()
      • testGroupByHaving2

        public void testGroupByHaving2()
      • testGroupByMinMaxSum

        public void testGroupByMinMaxSum()
      • testGroupComposite

        public void testGroupComposite()
      • testDistinctCount

        public void testDistinctCount()
      • testDistinctCountOrderBy

        public void testDistinctCountOrderBy()
      • testProject

        public void testProject()
      • testFilter

        public void testFilter()
      • testFilterReversed

        public void testFilterReversed()
        MongoDB's predicates are handed (they can only accept literals on the right-hand size) so it's worth testing that we handle them right both ways around.
      • checkPredicate

        private void checkPredicate​(int expected,
                                    java.lang.String q)
      • mongoChecker

        private static java.util.function.Consumer<java.util.List> mongoChecker​(java.lang.String... expected)
        Returns a function that checks that a particular MongoDB query has been called.
        expected - Expected query (as array)
        validation function