Class LatticeTest

  • public class LatticeTest
    extends java.lang.Object
    Unit test for lattices.
    • Constructor Detail

      • LatticeTest

        public LatticeTest()
    • Method Detail

      • modelWithLattice

        private static CalciteAssert.AssertThat modelWithLattice​(java.lang.String name,
                                                                 java.lang.String sql,
                                                                 java.lang.String... extras)
      • testLatticeSql

        public void testLatticeSql()
                            throws java.lang.Exception
        Tests that it's OK for a lattice to have the same name as a table in the schema.
      • testLattice

        public void testLattice()
                         throws java.lang.Exception
        Tests some of the properties of the Lattice data structure.
      • testLatticeWithSameNameAsTable

        public void testLatticeWithSameNameAsTable()
        Tests that it's OK for a lattice to have the same name as a table in the schema.
      • testTwoLatticesWithSameNameFails

        public void testTwoLatticesWithSameNameFails()
        Tests that it's an error to have two lattices with the same name in a schema.
      • testLatticeInvalidSqlFails

        public void testLatticeInvalidSqlFails()
        Tests a lattice whose SQL is invalid.
      • testLatticeSqlWithGroupByFails

        public void testLatticeSqlWithGroupByFails()
        Tests a lattice whose SQL is invalid because it contains a GROUP BY.
      • testLatticeSqlWithOrderByFails

        public void testLatticeSqlWithOrderByFails()
        Tests a lattice whose SQL is invalid because it contains a ORDER BY.
      • testLatticeSqlWithUnionFails

        public void testLatticeSqlWithUnionFails()
        Tests a lattice whose SQL is invalid because it contains a UNION ALL.
      • testLatticeSqlWithJoin

        public void testLatticeSqlWithJoin()
        Tests a lattice with valid join SQL.
      • testLatticeInvalidSql

        public void testLatticeInvalidSql()
        Tests a lattice with invalid SQL (for a lattice).
      • testLatticeInvalidSql2

        public void testLatticeInvalidSql2()
        Left join is invalid in a lattice.
      • testLatticeInvalidSql3

        public void testLatticeInvalidSql3()
        Each lattice table must have a parent.
      • testLatticeStarTable

        public void testLatticeStarTable()
        When a lattice is registered, there is a table with the same name. It can be used for explain, but not for queries.
      • testLatticeRecognizeJoin

        public void testLatticeRecognizeJoin()
        Tests that a 2-way join query can be mapped 4-way join lattice.
      • testLatticeRecognizeGroupJoin

        public void testLatticeRecognizeGroupJoin()
        Tests an aggregate on a 2-way join query can use an aggregate table.
      • testLatticeWithPreDefinedTiles

        public void testLatticeWithPreDefinedTiles()
        Tests a model with pre-defined tiles.
      • testLatticeWithPreDefinedTilesFewerMeasures

        public void testLatticeWithPreDefinedTilesFewerMeasures()
        A query that uses a pre-defined aggregate table, at the same granularity but fewer calls to aggregate functions.
      • testLatticeWithPreDefinedTilesRollUp

        public void testLatticeWithPreDefinedTilesRollUp()
        Tests a query that uses a pre-defined aggregate table at a lower granularity. Includes a measure computed from a grouping column, a measure based on COUNT rolled up using SUM, and an expression on a measure.
      • testTileAlgorithm2

        public void testTileAlgorithm2()
        As testTileAlgorithm(), but uses the Lattices.CACHED_SQL statistics provider.
      • testTileAlgorithm3

        public void testTileAlgorithm3()
        As testTileAlgorithm(), but uses the Lattices.PROFILER statistics provider.
      • checkTileAlgorithm

        private void checkTileAlgorithm​(java.lang.String statisticProvider,
                                        java.lang.String expectedExplain)
      • foodmartLatticeModel

        private static CalciteAssert.AssertThat foodmartLatticeModel​(java.lang.String statisticProvider)
      • testGroupByEmpty

        public void testGroupByEmpty()
        Tests a query that uses no columns from the fact table.
      • testGroupByEmpty2

        public void testGroupByEmpty2()
        Tests a query that uses no dimension columns and one measure column.
      • testGroupByEmpty3

        public void testGroupByEmpty3()
        Tests that two queries of the same dimensionality that use different measures can use the same materialization.
      • testSum

        public void testSum()
        Rolling up SUM.
      • testDistinctCount

        public void testDistinctCount()
        Tests a distinct-count query.

        We can't just roll up count(distinct ...) as we do count(...), but we can still use the aggregate table if we're smart.

      • testDistinctCount2

        public void testDistinctCount2()
      • testAllFoodmartQueries

        public void testAllFoodmartQueries()
        Runs all queries against the Foodmart schema, using a lattice.

        Disabled for normal runs, because it is slow.

      • check

        private void check​(int n)
      • testTileWithNoMeasures

        public void testTileWithNoMeasures()
        A tile with no measures should inherit default measure list from the lattice.
      • testLatticeWithNoMeasures

        public void testLatticeWithNoMeasures()
        A lattice with no default measure list should get "count(*)" is its default measure.
      • testDimensionIsInvalidColumn

        public void testDimensionIsInvalidColumn()
      • testMeasureArgIsInvalidColumn

        public void testMeasureArgIsInvalidColumn()
      • testMeasureArgIsNotUniqueAlias

        public void testMeasureArgIsNotUniqueAlias()
        It is an error for "customer_id" to be a measure arg, because is not a unique alias. Both "c" and "t" have "customer_id".
      • testMeasureAggIsInvalid

        public void testMeasureAggIsInvalid()
      • testTwoLattices

        public void testTwoLattices()
      • testSuggester

        public void testSuggester()
      • runJdbc

        private static void runJdbc()
                             throws java.sql.SQLException
      • testColumnCount

        public void testColumnCount()
        Unit test for Lattice.getRowCount(double, List).