org.eigenbase.test
Class SqlToRelTestBase.TesterImpl

java.lang.Object
  extended by org.eigenbase.test.SqlToRelTestBase.TesterImpl
All Implemented Interfaces:
SqlToRelTestBase.Tester
Direct Known Subclasses:
Rex2CalcPlanTest.TesterImpl
Enclosing class:
SqlToRelTestBase

public static class SqlToRelTestBase.TesterImpl
extends Object
implements SqlToRelTestBase.Tester

Default implementation of SqlToRelTestBase.Tester, using mock classes SqlToRelTestBase.MockRelOptSchema, SqlToRelTestBase.MockRelOptConnection and MockRelOptPlanner.


Field Summary
private  DiffRepository diffRepos
           
private  SqlOperatorTable opTab
           
private  RelOptPlanner planner
           
 
Constructor Summary
protected SqlToRelTestBase.TesterImpl(DiffRepository diffRepos)
          Creates a TesterImpl.
 
Method Summary
 void assertConvertsTo(String sql, String plan)
          Checks that a SQL statement converts to a given plan.
 RelNode convertSqlToRel(String sql)
          Converts a SQL string to a RelNode tree.
 SqlValidatorCatalogReader createCatalogReader(RelDataTypeFactory typeFactory)
          Factory method for a SqlValidatorCatalogReader.
protected  SqlOperatorTable createOperatorTable()
           
 RelOptPlanner createPlanner()
           
 SqlToRelTestBase.MockRelOptSchema createRelOptSchema(SqlValidatorCatalogReader catalogReader, RelDataTypeFactory typeFactory)
           
protected  SqlToRelConverter createSqlToRelConverter(SqlValidator validator, RelOptSchema relOptSchema, RelOptConnection relOptConnection, RelDataTypeFactory typeFactory)
           
protected  RelDataTypeFactory createTypeFactory()
           
 SqlValidator createValidator(SqlValidatorCatalogReader catalogReader, RelDataTypeFactory typeFactory)
          Factory method to create a SqlValidator.
 SqlConformance getConformance()
          Returns the SQL dialect to test.
 DiffRepository getDiffRepos()
           
 SqlOperatorTable getOperatorTable()
          Returns the SqlOperatorTable to use.
protected  RelOptPlanner getPlanner()
           
 SqlNode parseQuery(String sql)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

planner

private RelOptPlanner planner

opTab

private SqlOperatorTable opTab

diffRepos

private final DiffRepository diffRepos
Constructor Detail

SqlToRelTestBase.TesterImpl

protected SqlToRelTestBase.TesterImpl(DiffRepository diffRepos)
Creates a TesterImpl.

Parameters:
diffRepos - Diff repository
Method Detail

convertSqlToRel

public RelNode convertSqlToRel(String sql)
Description copied from interface: SqlToRelTestBase.Tester
Converts a SQL string to a RelNode tree.

Specified by:
convertSqlToRel in interface SqlToRelTestBase.Tester
Parameters:
sql - SQL statement
Returns:
Relational expression, never null

createRelOptSchema

public SqlToRelTestBase.MockRelOptSchema createRelOptSchema(SqlValidatorCatalogReader catalogReader,
                                                            RelDataTypeFactory typeFactory)
Specified by:
createRelOptSchema in interface SqlToRelTestBase.Tester

createSqlToRelConverter

protected SqlToRelConverter createSqlToRelConverter(SqlValidator validator,
                                                    RelOptSchema relOptSchema,
                                                    RelOptConnection relOptConnection,
                                                    RelDataTypeFactory typeFactory)

createTypeFactory

protected RelDataTypeFactory createTypeFactory()

getPlanner

protected final RelOptPlanner getPlanner()

parseQuery

public SqlNode parseQuery(String sql)
                   throws Exception
Specified by:
parseQuery in interface SqlToRelTestBase.Tester
Throws:
Exception

getConformance

public SqlConformance getConformance()
Description copied from interface: SqlToRelTestBase.Tester
Returns the SQL dialect to test.

Specified by:
getConformance in interface SqlToRelTestBase.Tester

createValidator

public SqlValidator createValidator(SqlValidatorCatalogReader catalogReader,
                                    RelDataTypeFactory typeFactory)
Description copied from interface: SqlToRelTestBase.Tester
Factory method to create a SqlValidator.

Specified by:
createValidator in interface SqlToRelTestBase.Tester

getOperatorTable

public final SqlOperatorTable getOperatorTable()
Description copied from interface: SqlToRelTestBase.Tester
Returns the SqlOperatorTable to use.

Specified by:
getOperatorTable in interface SqlToRelTestBase.Tester

createOperatorTable

protected SqlOperatorTable createOperatorTable()

createCatalogReader

public SqlValidatorCatalogReader createCatalogReader(RelDataTypeFactory typeFactory)
Description copied from interface: SqlToRelTestBase.Tester
Factory method for a SqlValidatorCatalogReader.

Specified by:
createCatalogReader in interface SqlToRelTestBase.Tester

createPlanner

public RelOptPlanner createPlanner()
Specified by:
createPlanner in interface SqlToRelTestBase.Tester

assertConvertsTo

public void assertConvertsTo(String sql,
                             String plan)
Description copied from interface: SqlToRelTestBase.Tester
Checks that a SQL statement converts to a given plan.

Specified by:
assertConvertsTo in interface SqlToRelTestBase.Tester
Parameters:
sql - SQL query
plan - Expected plan

getDiffRepos

public DiffRepository getDiffRepos()
Specified by:
getDiffRepos in interface SqlToRelTestBase.Tester