Class SqlToRelTestBase.TesterImpl

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected TesterImpl​(DiffRepository diffRepos, boolean enableDecorrelate, boolean enableTrim, boolean enableExpand, boolean enableLateDecorrelate, SqlTestFactory.MockCatalogReaderFactory catalogReaderFactory, java.util.function.Function<org.apache.calcite.plan.RelOptCluster,​org.apache.calcite.plan.RelOptCluster> clusterFactory)
      Creates a TesterImpl.
      protected TesterImpl​(DiffRepository diffRepos, boolean enableDecorrelate, boolean enableTrim, boolean enableExpand, boolean enableLateDecorrelate, SqlTestFactory.MockCatalogReaderFactory catalogReaderFactory, java.util.function.Function<org.apache.calcite.plan.RelOptCluster,​org.apache.calcite.plan.RelOptCluster> clusterFactory, org.apache.calcite.sql2rel.SqlToRelConverter.Config config, org.apache.calcite.sql.validate.SqlConformance conformance, org.apache.calcite.plan.Context context)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void assertConvertsTo​(java.lang.String sql, java.lang.String plan)
      Checks that a SQL statement converts to a given plan.
      void assertConvertsTo​(java.lang.String sql, java.lang.String plan, boolean trim)
      Checks that a SQL statement converts to a given plan, optionally trimming columns that are not needed.
      org.apache.calcite.rel.RelRoot convertSqlToRel​(java.lang.String sql)
      Converts a SQL string to a RelNode tree.
      org.apache.calcite.prepare.Prepare.CatalogReader createCatalogReader​(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory)
      Factory method for a Prepare.CatalogReader.
      org.apache.calcite.sql2rel.RelFieldTrimmer createFieldTrimmer​(org.apache.calcite.tools.RelBuilder relBuilder)
      Creates a RelFieldTrimmer.
      protected org.apache.calcite.sql.SqlOperatorTable createOperatorTable()
      Creates an operator table.
      org.apache.calcite.plan.RelOptPlanner createPlanner()  
      protected org.apache.calcite.sql2rel.SqlToRelConverter createSqlToRelConverter​(org.apache.calcite.sql.validate.SqlValidator validator, org.apache.calcite.prepare.Prepare.CatalogReader catalogReader, org.apache.calcite.rel.type.RelDataTypeFactory typeFactory, org.apache.calcite.sql2rel.SqlToRelConverter.Config config)  
      protected org.apache.calcite.rel.type.RelDataTypeFactory createTypeFactory()  
      org.apache.calcite.sql.validate.SqlValidator createValidator​(org.apache.calcite.sql.validate.SqlValidatorCatalogReader catalogReader, org.apache.calcite.rel.type.RelDataTypeFactory typeFactory)
      Factory method to create a SqlValidator.
      org.apache.calcite.sql.validate.SqlConformance getConformance()
      Returns the SQL dialect to test.
      DiffRepository getDiffRepos()
      Returns the diff repository.
      org.apache.calcite.sql.SqlOperatorTable getOperatorTable()
      Returns the SqlOperatorTable to use.
      protected org.apache.calcite.plan.RelOptPlanner getPlanner()  
      protected org.apache.calcite.rel.type.RelDataTypeFactory getTypeFactory()  
      org.apache.calcite.sql.validate.SqlValidator getValidator()
      Returns the validator.
      boolean isLateDecorrelate()  
      org.apache.calcite.sql.SqlNode parseQuery​(java.lang.String sql)  
      SqlToRelTestBase.Tester withCatalogReaderFactory​(SqlTestFactory.MockCatalogReaderFactory factory)  
      SqlToRelTestBase.Tester withClusterFactory​(java.util.function.Function<org.apache.calcite.plan.RelOptCluster,​org.apache.calcite.plan.RelOptCluster> clusterFactory)  
      SqlToRelTestBase.TesterImpl withConfig​(org.apache.calcite.sql2rel.SqlToRelConverter.Config config)
      Returns a tester that optionally uses a SqlToRelConverter.Config.
      SqlToRelTestBase.Tester withConformance​(org.apache.calcite.sql.validate.SqlConformance conformance)
      Returns a tester with a SqlConformance.
      SqlToRelTestBase.Tester withContext​(org.apache.calcite.plan.Context context)
      Returns a tester that uses a given context.
      SqlToRelTestBase.TesterImpl withDecorrelation​(boolean enableDecorrelate)
      Returns a tester that optionally decorrelates queries.
      SqlToRelTestBase.Tester withExpand​(boolean enableExpand)
      Returns a tester that optionally expands sub-queries.
      SqlToRelTestBase.Tester withLateDecorrelation​(boolean enableLateDecorrelate)
      Returns a tester that optionally decorrelates queries after planner rules have fired.
      SqlToRelTestBase.Tester withTrim​(boolean enableTrim)
      Returns a tester that optionally trims unused fields.
      • Methods inherited from class java.lang.Object

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

      • planner

        private org.apache.calcite.plan.RelOptPlanner planner
      • opTab

        private org.apache.calcite.sql.SqlOperatorTable opTab
      • enableDecorrelate

        private final boolean enableDecorrelate
      • enableLateDecorrelate

        private final boolean enableLateDecorrelate
      • enableTrim

        private final boolean enableTrim
      • enableExpand

        private final boolean enableExpand
      • conformance

        private final org.apache.calcite.sql.validate.SqlConformance conformance
      • clusterFactory

        private final java.util.function.Function<org.apache.calcite.plan.RelOptCluster,​org.apache.calcite.plan.RelOptCluster> clusterFactory
      • typeFactory

        private org.apache.calcite.rel.type.RelDataTypeFactory typeFactory
      • config

        public final org.apache.calcite.sql2rel.SqlToRelConverter.Config config
      • context

        private final org.apache.calcite.plan.Context context
    • Constructor Detail

      • TesterImpl

        protected TesterImpl​(DiffRepository diffRepos,
                             boolean enableDecorrelate,
                             boolean enableTrim,
                             boolean enableExpand,
                             boolean enableLateDecorrelate,
                             SqlTestFactory.MockCatalogReaderFactory catalogReaderFactory,
                             java.util.function.Function<org.apache.calcite.plan.RelOptCluster,​org.apache.calcite.plan.RelOptCluster> clusterFactory)
        Creates a TesterImpl.
        Parameters:
        diffRepos - Diff repository
        enableDecorrelate - Whether to decorrelate
        enableTrim - Whether to trim unused fields
        enableExpand - Whether to expand sub-queries
        catalogReaderFactory - Function to create catalog reader, or null
        clusterFactory - Called after a cluster has been created
      • TesterImpl

        protected TesterImpl​(DiffRepository diffRepos,
                             boolean enableDecorrelate,
                             boolean enableTrim,
                             boolean enableExpand,
                             boolean enableLateDecorrelate,
                             SqlTestFactory.MockCatalogReaderFactory catalogReaderFactory,
                             java.util.function.Function<org.apache.calcite.plan.RelOptCluster,​org.apache.calcite.plan.RelOptCluster> clusterFactory,
                             org.apache.calcite.sql2rel.SqlToRelConverter.Config config,
                             org.apache.calcite.sql.validate.SqlConformance conformance,
                             org.apache.calcite.plan.Context context)